server { listen 80; server_name _; root /usr/share/nginx/html; charset utf-8; # Quartz-compatible URLs: /A/B -> A/B.html, /Folder/ -> Folder/index.html location / { try_files $uri $uri.html $uri/index.html =404; } # The notebooks listing builds to notebooks.html *and* has a sibling # notebooks/ directory of detail pages. try_files above resolves # /notebooks and /notebooks/, but not the trailing-slash form — # a bare directory has no index.html. Map it explicitly so every folder # URL on the site keeps working with or without the slash. location = /notebooks/ { try_files /notebooks.html =404; } location /assets/ { expires 7d; add_header Cache-Control "public"; } location /_astro/ { # content-hashed filenames — safe to cache hard expires 365d; add_header Cache-Control "public, immutable"; } }