server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Gzip text assets gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css application/javascript application/json image/svg+xml; # Hashed build assets are immutable -> cache aggressively location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # SPA history fallback: unknown routes serve index.html location / { try_files $uri $uri/ /index.html; } # Never cache the HTML entrypoint so new deploys are picked up immediately location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } }