server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Security headers add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "DENY" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Enable compression gzip on; gzip_types text/css application/javascript text/javascript application/wasm image/svg+xml; gzip_min_length 512; # Immutable cache for hashed assets location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } # Everything else → index.html (SPA fallback) location / { try_files $uri $uri/ /index.html; expires -1; add_header Cache-Control "no-cache"; } }