server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Static export with trailingSlash: serve dir/index.html, or the .html twin. location / { try_files $uri $uri/ $uri.html /index.html; } # Never cache HTML — new deploys (new chunk hashes) are picked up immediately. location ~* \.html$ { add_header Cache-Control "no-cache, no-store, must-revalidate"; } # Long-cache immutable, content-hashed build assets. location /_next/static/ { expires 1y; add_header Cache-Control "public, immutable"; } }