server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html index.htm; # Gzip compression for high performance gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; # SPA routing: fallback to index.html for client-side routing location / { try_files $uri $uri/ /index.html; } # Cache static assets with long TTL location /assets/ { expires 1y; add_header Cache-Control "public, no-transform, immutable"; } # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Health check endpoint location /healthz { access_log off; return 200 "healthy\n"; } }