Files
argento/docker/nginx/conf.d/_template.conf.example
2026-04-07 15:46:18 -04:00

49 lines
1.4 KiB
Plaintext

# Template for new app confs.
# 1. Copy this file: cp _template.conf.example <domain>.conf
# 2. Replace DOMAIN with the actual domain
# 3. Replace UPSTREAM_NAME and CONTAINER:PORT with the app's container and port
# 4. Run issue-cert.sh <domain> if cert doesn't exist yet
# 5. Copy to argento, nginx -t && nginx -s reload
server {
listen 80;
listen [::]:80;
server_name DOMAIN;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name DOMAIN;
ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
include /etc/nginx/conf.d/security-headers.inc;
# Use a variable so nginx starts even if the upstream is down
set $upstream_UPSTREAM_NAME http://CONTAINER:PORT;
location / {
proxy_pass $upstream_UPSTREAM_NAME;
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;
# Uncomment if the app uses WebSockets
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
}
}