Pinning a static site to one small server
This site is eleven files and a stylesheet. It runs on the smallest instance I could rent: one shared vCPU, one gigabyte of memory, a ten gigabyte disk. The interesting question is not whether that is enough — it obviously is — but how much of the machine the static site is allowed to claim.
The budget
A minimal nginx serving files costs about 8–12 MB resident and roughly nothing in CPU. The rest of the box is spoken for by things that are not the website: a TLS front end, a container runtime, backups. Once you write the budget down, the rule becomes obvious — do not install a language runtime to render six HTML files.
The tradeoffs that actually bite on a box this size:
- Disk first. Package caches and old container layers fill ten gigabytes faster than anyone expects. I check
dfbefore every change now. - Memory second. A Java service or a database with default buffers will take the whole gigabyte and leave the web server to swap.
- Everything else distant third. Text over TLS is cheap; if the site is slow, it is almost never the web server.
Caching
Static files get an ETag and a Last-Modified for free. The only header worth adding by hand is a cache lifetime for the stylesheet, and only after you are willing to rename it when it changes:
location /assets/ {
add_header Cache-Control "public, max-age=604800";
}
That is the whole performance plan. There is no CDN in front of this site, no build step, and no database. When something is wrong here, it is a certificate, a DNS record, or the network — never the renderer, because there is no renderer.