Files
brain/deploy/nginx/computer.conf.template
T
Andrew S Erwin b9721ff13f
release gate / check (push) Failing after 8m35s
initial commit on Federted servers
2026-10-19 16:23:55 -05:00

51 lines
2.0 KiB
Plaintext

# nginx reverse proxy template for the computer stack.
# scripts/server-deploy.sh renders __DOMAIN__ and __WEB_PORT__ (the server's
# WEB_HOST_PORT binding) into the installed site config. The Go API is reached
# only through web, as in local dev. TLS certificates come from certbot
# (Let's Encrypt); see scripts/deploy.sh.
server {
listen 80;
listen [::]:80;
server_name __DOMAIN__;
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;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1h;
ssl_prefer_server_ciphers off;
# Security headers (review CFG-2): HSTS, frame protection.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# CSP is deliberately NOT set here (review CR-10): the Next app emits a
# per-response nonce-based Content-Security-Policy from web/middleware.ts,
# which is what allows the App Router's inline bootstrap scripts to run.
# A second nginx-level CSP would intersect with it and strip the nonce,
# breaking hydration. nginx only passes the app's header through.
location / {
proxy_pass http://127.0.0.1:__WEB_PORT__;
proxy_http_version 1.1;
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;
# WebSocket upgrade (harmless when unused).
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 75s;
}
}