การเข้าถึง Dockge
- เปิดเบราว์เซอร์แล้วไปที่:
https://<SERVER_IP> - คาดว่าจะมีคำเตือน SSL จากเบราว์เซอร์ (self-signed certificate)
- สร้างบัญชีผู้ดูแลระบบในการเข้าถึงครั้งแรก
ไฟล์และไดเรกทอรีสำคัญ
- ไดเรกทอรี่การติดตั้ง:
/opt/dockge - Compose file:
ไฟล์ Compose:
/opt/dockge/compose.yaml - ไดเรกทอรี่ Stacks
/opt/stacks - Dockge ข้อมูล:
/opt/dockge/data - Nginx config
/etc/nginx/sites-available/dockge - ใบรับรอง TLS:
/etc/nginx/ssl
เปิดใช้งาน SSL พร้อมโดเมน
1. ชี้โดเมนของคุณไปที่ IP ของเซิร์ฟเวอร์
2. แก้ไขไฟล์คอนฟิก Nginx และแทนที่ทั้งสองส่วน server_name <IP>; ด้วยโดเมนของคุณ (<your-domain>) สำหรับทั้งบล็อก HTTP (port 80) และ HTTPS (port 443):
vim /etc/nginx/sites-available/deockge
3. ติดตั้ง Certbot:
apt install -y certbot python3-certbot-nginx
4. รันคำสั่งต่อไปนี้เพื่อสร้างใบรับรอง Let's Encrypt ที่ถูกต้อง:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. แทนที่พาธ SSL ในไฟล์คอนฟิก Nginx:
vim /etc/nginx/sites-available/dockge
# Before:
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. รีสตาร์ท Nginx เพื่อให้การเปลี่ยนแปลงมีผล:
systemctl restart nginx
7. เปิดเบราว์เซอร์และไปที่: https://yourdomain.com
หมายเหตุ
- Dockge ใช้
/var/run/docker.sockเพื่อควบคุม Docker - Nginx ถูกตั้งค่าให้ใช้ HTTPS และ redirect HTTP → HTTPS
- เฉพาะ Dockge UI เท่านั้นที่ใช้ HTTPS ส่วนแอปอื่นใช้
http://<IP>:<PORT>(ไม่มี HTTPS อัตโนมัติ)