video-shuoshan/web/nginx.conf
zyc c885051ab3
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 20s
fix: nginx config serving assets as text/html instead of correct MIME type
2026-04-04 12:58:28 +08:00

38 lines
1.1 KiB
Nginx Configuration File

server_tokens off;
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# API requests proxy to backend service
location /api/ {
proxy_pass http://video-backend:8000;
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_read_timeout 120s;
client_max_body_size 50m;
}
# Cache static assets (must be before SPA fallback)
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# SPA fallback — real files served directly, all other paths return index.html
location / {
try_files $uri $uri/ /index.html;
}
}