Truy cập
- Mở trình duyệt và truy cập:
https://<SERVER_IP> - Cảnh báo SSL trên trình duyệt là điều dự kiến (chứng chỉ tự ký)
- Yêu cầu xác thực (cửa sổ Basic Auth)
- Phương thức xác thực: HTTP Basic Auth
- Thông tin đăng nhập được lưu trữ bảo mật tại:
/root/.cloudzy-creds
File và thư mục quan trọng
- Thư mục cài đặt:
/opt/glance - Docker Compose:
/opt/glance/docker-compose.yml - File environment:
/opt/glance/.env - Thư mục cấu hình:
/opt/glance/config - Cấu hình chính:
/opt/glance/config/home.yml - Cấu hình chính:
/opt/glance/config/glance.yml - Thư mục tài nguyên:
/opt/glance/assets - CSS tùy chỉnh:
/opt/glance/assets/user.css - Cấu hình Nginx:
/etc/nginx/sites-available/glance.conf - Chứng chỉ SSL:
/etc/nginx/ssl - Tệp xác thực:
/etc/nginx/auth/.glance-htpasswd - Tệp xác thực:
/root/.glance-credentials
Quản lý Stack
Go vào thư mục cài đặt:
cd /opt/glance
Các lệnh Docker Compose thường dùng:
# 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
Tắt HTTP Basic Auth trong Nginx (Tùy chọn)
Chỉnh sửa file site Nginx: /etc/nginx/sites-available/glance.conf
Xóa hoặc comment out các dòng sau:
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/.glance-htpasswd;
Tải lại Nginx:
systemctl restart nginx
Kích hoạt SSL với một tên miền
1. Trỏ tên miền của bạn về IP máy chủ.
2. Sửa cấu hình Nginx và thay thế cả server_name <IP>; với tên miền của bạn (<your-domain>) cho cả block HTTP (cổng 80) và HTTPS (cổng 443):
vim /etc/nginx/sites-available/glance.conf
3. Cài đặt Certbot:
apt install -y certbot python3-certbot-nginx
4. Chạy lệnh sau để tạo một chứng chỉ Let’s Encrypt hợp lệ:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. Thay thế các đường dẫn SSL trong cấu hình 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. Khởi động lại Nginx để áp dụng thay đổi:
systemctl restart nginx
7. Mở trình duyệt và truy cập: https://yourdomain.com