A third instance of the pattern notebooks-export/ and the reading payloads already use: an artifact built somewhere with a toolchain this repo's node:24-slim container does not have, dropped into a gitignored directory, staged into public/ by a script, and picked up by auto-build.sh's signature on the next tick. Nothing here needs a JDK, Go, or an opinion about the game -- cannons_reloaded's deploy/export-cannons.sh hands over a directory that is already ready to serve. Three things are load-bearing and easy to get wrong later: The payload is at /cn/, not /cannons/. With build.format:'file' the page builds to cannons.html, and try_files would then have a file and a directory competing for the same URL. That is exactly why the notebook exports live at /nb/ and not under /notebooks/. nginx gets gzip_static for /cn/. nginx:alpine has `gzip on` commented out in its base config, so without it the page ships 9MB instead of 3.3MB and nothing anywhere reports that. It gets no-cache rather than an expiry, because classes.js and cannons.wasm are stable filenames whose contents change on every rebuild -- a long expiry would pair a stale client with a fresh server. The page loads on click, not `loading="lazy"`. Lazy only defers until the frame nears the viewport and this frame is above the fold, so a few MB would download for anyone who opened the page to read the paragraph. A missing export is a normal state throughout: copy-cannons.mjs stages nothing, the page says so, and the sidebar link does not appear. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S4wdbGSVzvUDHBWRjSVxfr
49 lines
1.7 KiB
Nginx Configuration File
49 lines
1.7 KiB
Nginx Configuration File
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/<slug>, 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";
|
|
}
|
|
|
|
# The ACannons browser build. gzip_static serves the .gz siblings that
|
|
# export-cannons.sh writes, which is the difference between 3.3MB and 9MB
|
|
# on the wire; nginx:alpine ships --with-http_gzip_static_module but has
|
|
# `gzip on` COMMENTED OUT in its base config, so without this the page
|
|
# would go out uncompressed and nothing would say so.
|
|
#
|
|
# no-cache, not `expires`: classes.js and cannons.wasm are stable
|
|
# filenames whose contents change on every rebuild, so a long expiry would
|
|
# serve a stale client against a fresh server until the cache aged out.
|
|
# The browser still caches them and revalidates, which is a 304 and a few
|
|
# bytes on an unchanged build.
|
|
location /cn/ {
|
|
gzip_static on;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
location /_astro/ {
|
|
# content-hashed filenames — safe to cache hard
|
|
expires 365d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|