server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Gzip static assets gzip on; gzip_types text/plain text/css application/json application/javascript text/javascript application/xml text/xml image/svg+xml; gzip_min_length 1024; # Long cache for hashed static assets location /_next/static/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } # Favicon / icon location = /favicon.ico { try_files /icon.svg =404; } location = /icon.svg { add_header Cache-Control "public, max-age=86400"; } # Next static export : Adam a configuré trailingSlash: true, les URLs sont /foo/ → index.html location / { try_files $uri $uri/ $uri.html $uri/index.html =404; } # 404 error_page 404 /404.html; }