server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html; # ---- security headers ---- add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always; # ---- SPA fallback (no-op today, but keeps future client routes working) ---- location / { try_files $uri $uri/ /index.html; } # ---- Vite emits content-hashed filenames under /assets — safe to cache forever ---- location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } # ---- index.html must always revalidate so deploys pick up immediately ---- location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } # ---- gzip ---- gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml application/xml+rss application/wasm; }