server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html; charset utf-8; gzip_static on; error_page 404 /404.html; # hashed build assets: cache forever location /_astro/ { include /etc/nginx/snippets/security-headers.conf; add_header Cache-Control "public, max-age=31536000, immutable" always; try_files $uri =404; } # everything else (HTML, sitemap, offline artifact): revalidate location / { include /etc/nginx/snippets/security-headers.conf; add_header Cache-Control "no-cache" always; try_files $uri $uri/ =404; } }