# nginx site for bifrost-portal.fenja.ai # Reverse-proxies to the Bifrost portal Node server on 127.0.0.1:4322. # Coexists with other Fenja sites on this box — it only claims this hostname. # # Install: # sudo cp deploy/nginx/bifrost-portal.fenja.ai.conf /etc/nginx/sites-available/ # sudo ln -s /etc/nginx/sites-available/bifrost-portal.fenja.ai.conf /etc/nginx/sites-enabled/ # sudo nginx -t && sudo systemctl reload nginx # # TLS: obtain the cert first (see DEPLOY.md). Either run # sudo certbot --nginx -d bifrost-portal.fenja.ai # (certbot edits this file in place), OR issue with --webroot and keep the # 443 block below as-is. The :80 block must exist before certbot runs. # HTTP — ACME challenge + redirect everything else to HTTPS. server { listen 80; listen [::]:80; server_name bifrost-portal.fenja.ai; location /.well-known/acme-challenge/ { root /var/www/html; } location / { return 301 https://$host$request_uri; } } # HTTPS — terminates TLS, proxies to the Node app. server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name bifrost-portal.fenja.ai; ssl_certificate /etc/letsencrypt/live/bifrost-portal.fenja.ai/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/bifrost-portal.fenja.ai/privkey.pem; # Modern TLS defaults (Mozilla "intermediate"). If certbot manages this # file it may append its own ssl_* includes — harmless duplicates aside. ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers off; # Event photo uploads can be a few MB; keep headroom above the app's limit. client_max_body_size 12m; # Security headers. HSTS only after you've confirmed HTTPS works end-to-end. add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options SAMEORIGIN always; add_header Referrer-Policy strict-origin-when-cross-origin always; # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; location / { proxy_pass http://127.0.0.1:4322; 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; proxy_set_header X-Forwarded-Host $host; # Upgrade headers in case any route uses them; harmless otherwise. proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 60s; } }