Setting Up Domain with HTTPS
Follow these steps to set up Nginx as a reverse proxy for QGato with HTTPS using Certbot. This guide assumes you are using Debian/Ubuntu. For more detailed or alternative Nginx setups, search online for platform-specific guides.
Prerequisites
-
A domain name (e.g.,
example.com
). -
QGato running on a server (e.g.,
localhost:5000
). -
Nginx installed on your server.
sudo apt update sudo apt install -y nginx
-
Certbot installed for SSL certificates.
sudo apt install -y certbot python3-certbot-nginx
Nginx Configuration
-
Create a new Nginx configuration file:
sudo nano /etc/nginx/sites-available/qgato
-
Add the following configuration:
server { listen 80; server_name example.com; location / { proxy_pass http://localhost:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
-
Enable the configuration:
sudo ln -s /etc/nginx/sites-available/qgato /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx
Enable HTTPS with Certbot
-
Obtain an SSL certificate for your domain:
sudo certbot --nginx -d example.com
-
Update the Nginx configuration to redirect HTTP to HTTPS and listen on port 443. Edit the configuration file:
sudo nano /etc/nginx/sites-available/qgato
Add or replace the configuration with:
server { listen 80; server_name example.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location / { proxy_pass http://localhost:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
-
Reload Nginx to apply changes:
sudo systemctl reload nginx
Renew SSL Certificates Automatically
Certbot should automatically sets up a cron job for certificate renewal. To ensure it works correctly:
-
Test the renewal process:
sudo certbot renew --dry-run
-
If the test succeeds, Certbot will renew certificates automatically before expiration.
Final Steps
- Access QGato at:
https://example.com
- Ensure Nginx and Certbot are working together seamlessly for secure, automated HTTPS.
That's it! Your QGato instance is now securely running behind Nginx with HTTPS.
Navigation
Repository | Demo | License