server { listen 80 default_server; server_name _; root /usr/share/nginx/html; index index.html; # Gzip gzip on; gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml; gzip_min_length 1024; # 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; # No cache for HTML (let users see changes after redeploy) location ~* \.html$ { add_header Cache-Control "no-cache, no-store, must-revalidate"; add_header Pragma "no-cache"; expires 0; } # Long cache for static assets location ~* \.(jpg|jpeg|png|gif|webp|svg|woff|woff2|ttf|eot)$ { expires 30d; add_header Cache-Control "public, immutable"; } location / { try_files $uri $uri/ /index.html; } }