server { 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; # Gzip gzip on; gzip_vary on; gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml; gzip_min_length 1024; gzip_comp_level 6; # Cache static assets location ~* \.(css|js|jsx|woff2?|ttf|svg|png|jpg|jpeg|ico|gif|webp)$ { expires 7d; add_header Cache-Control "public, immutable"; try_files $uri =404; } # All routes → index.html (SPA / static) location / { try_files $uri $uri/ /index.html; } }