Access
- เปิดเบราว์เซอร์แล้วไปที่:
https://<SERVER_IP> - คาดว่าจะมีคำเตือน SSL จากเบราว์เซอร์ (self-signed certificate)
- ต้องมีการยืนยันตัวตน (Basic Auth popup)
- วิธียืนยันตัวตน: HTTP Basic Auth
- ข้อมูล credentials ถูกเก็บอย่างปลอดภัยใน:
/root/.cloudzy-creds
ไฟล์และไดเรกทอรีสำคัญ
- Install directory:
/opt/glance - Docker Compose:
/opt/glance/docker-compose.yml - Environment file:
/opt/glance/.env - Config directory:
/opt/glance/config - Home config:
/opt/glance/config/home.yml - Main config:
/opt/glance/config/glance.yml - Assets directory:
/opt/glance/assets - Custom CSS:
/opt/glance/assets/user.css - Nginx config:
/etc/nginx/sites-available/glance.conf - SSL certificates:
/etc/nginx/ssl - Auth file:
/etc/nginx/auth/.glance-htpasswd - Credentials file:
/root/.glance-credentials
จัดการ Stack
Go ไปยังไดเรกทอรีติดตั้ง:
cd /opt/glance
คำสั่ง Docker Compose ที่ใช้บ่อย:
# Check status
docker compose ps
# View logs (follow live)
docker compose logs -f
# Restart all services
docker compose restart
# Stop services
docker compose down
# Start again
docker compose up -d
ปิดใช้งาน HTTP Basic Auth ใน Nginx (ไม่บังคับ)
แก้ไขไฟล์ไซต์ Nginx: /etc/nginx/sites-available/glance.conf
ลบหรือคอมเมนต์บรรทัดเหล่านี้:
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/.glance-htpasswd;
Reload Nginx:
systemctl restart nginx
เปิดใช้งาน SSL พร้อมโดเมน
1. ชี้โดเมนของคุณไปที่ IP ของเซิร์ฟเวอร์
2. แก้ไขไฟล์คอนฟิก Nginx และแทนที่ทั้งสองส่วน server_name <IP>; ด้วยโดเมนของคุณ (<your-domain>) สำหรับทั้งบล็อก HTTP (port 80) และ HTTPS (port 443):
vim /etc/nginx/sites-available/glance.conf
3. Install 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/glance.conf
# 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