Accessing Gatus
- Mở trình duyệt của bạn và truy cập:
https://<SERVER_IP> - Cảnh báo SSL của trình duyệt (chứng chỉ tự ký) là điều bình thường.
- Cần xác thực (Cửa sổ bật lên Xác thực cơ bản)
- Phương thức xác thực: Xác thực cơ bản HTTP
- Thông tin đăng nhập được lưu trữ an toàn tại:
/root/.cloudzy-creds
Các tập tin và thư mục quan trọng
- Thư mục cài đặt:
/opt/gatus - Docker Compose:
/opt/gatus/docker-compose.yml - Tệp môi trường:
/opt/gatus/.env - Config directory:
/opt/gatus/config/ - Tệp cấu hình chính:
/opt/gatus/config/config.yaml - Database directory:
/opt/gatus/data/db - Cấu hình Nginx:
/etc/nginx/sites-available/gatus.conf - Đã kích hoạt trang web Nginx:
/etc/nginx/sites-enabled/gatus.conf - Chứng chỉ SSL:
/etc/nginx/ssl/ - HTTP Basic Auth file:
/etc/nginx/auth/.gatus-htpasswd - Tệp thông tin xác thực:
/root/.gatus-credentials
Configuration Behavior
- Configuration files are located in
/opt/gatus/config/ - YAML can be split into multiple files
- Changes are auto-reloaded
- No restart is required after edits
Manage the Stack
Go to the installation directory:
cd /opt/gatus
Common Docker Compose commands:
# 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
Disable HTTP Basic Auth in Nginx (Optional)
Edit the Nginx site file: /etc/nginx/sites-available/gatus.conf
Remove or comment out these lines:
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/.gatus-htpasswd;
Khởi động lại Nginx:
systemctl restart nginx
Kích hoạt SSL với tên miền
1. Trỏ tên miền của bạn đến địa chỉ IP của máy chủ.
2. Chỉnh sửa cấu hình Nginx và thay thế cả hai server_name <IP>; với tên miền của bạn (<your-domain>) cho cả khối HTTP (cổng 80) và HTTPS (cổng 443):
vim /etc/nginx/sites-available/gatus.conf
3. Cài đặt Certbot:
apt install -y certbot python3-certbot-nginx
4. Chạy lệnh sau để tạo 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ế đường dẫn SSL trong cấu hình Nginx:
vim /etc/nginx/sites-available/gatus.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 các thay đổi:
systemctl restart nginx
7. Mở trình duyệt của bạn và truy cập: https://yourdomain.com