copyparty/docs/examples/docker/basic-docker-compose/nginx-example.nginx

36 lines
1.5 KiB
Nginx Configuration File

# 1. create this file: nano /etc/nginx/sites-available/example.mydomain.com
# 2. activate with symlink: ln -s /etc/nginx/sites-available/example.mydomain.com /etc/nginx/sites-enabled/
# 3. test config: nginx -t
# 4. reload nginx: systemctl reload nginx
# 5. run certbot: certbot --nginx
server {
listen 80;
listen [::]:80;
server_name example.mydomain.com; # <--- REPLACE THIS
# ----------------------------------------------------------------------
# NOTE: When you run 'certbot --nginx', it will automatically:
# 1. Change 'listen 80' to 'listen 443 ssl'
# 2. Insert the SSL certificate paths
# 3. Create a NEW server block for port 80 at the bottom to redirect HTTP -> HTTPS
# ----------------------------------------------------------------------
# Allow unlimited upload size (just compat for specific basic clients, curl etc)
client_max_body_size 0;
location / {
proxy_pass http://127.0.0.1:3923; # <--- REPLACE PORT IF NEEDED
# Connection Headers
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; # Better compatibility than hardcoded "Keep-Alive"
# IP Forwarding Headers
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;
}
}