server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Static Next.js export: serve the file, its .html twin, or fall back to the # SPA shell (the app uses client-side hash routing). location / { try_files $uri $uri.html $uri/ /index.html; } # Never cache the HTML shell — so a new deploy (with new chunk hashes) is # always picked up immediately and tabs don't load a stale bundle. location ~* \.html$ { add_header Cache-Control "no-cache, no-store, must-revalidate"; try_files $uri /index.html; } # Long-cache immutable, content-hashed build assets. location /_next/static/ { expires 1y; add_header Cache-Control "public, immutable"; } }