watch-party/frontend/ops/nginx.conf.template
2025-11-11 22:48:57 +09:00

31 lines
836 B
Plaintext

server {
listen 80;
server_name _;
# Static files for the SPA
root /usr/share/nginx/html;
index index.html;
# Redirect bare root to /watch-party/
location = / { return 302 /watch-party/; }
# Ensure trailing slash
location = /watch-party { return 302 /watch-party/; }
# Serve SPA under /watch-party/
location /watch-party/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ /index.html;
}
# Backend API (preserve /api/v1/… path)
location /api/ {
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 Connection "";
proxy_pass ${BACKEND_ORIGIN}; # no trailing slash!
}
}