nginx on a 512 MB box
This site runs on a VPS with half a gigabyte of memory and one virtual core. Most nginx tuning guides assume a machine fifty times larger, so I measured what actually changes anything at this size.
Settings that mattered
worker_processes 1;
events { worker_connections 512; }
http {
sendfile on;
tcp_nopush on;
keepalive_timeout 30s;
gzip on;
gzip_types text/css application/atom+xml image/svg+xml;
open_file_cache max=200 inactive=60s;
}
worker_processes 1.autogives the same result on one core, but being explicit stops it from surprising you after a plan upgrade.open_file_cachecut median latency for small static pages by about a third under load, because the disk on cheap plans is slow and shared.- gzip for CSS and the feed. HTML here is small enough that it barely matters; the feed compresses from 38 KB to 9 KB.
Settings that did not
Buffer sizes, multi_accept, and switching event methods made no measurable difference with realistic traffic. I left them at defaults so the config stays short enough to read in one screen.
Memory
Resident memory for the master plus one worker sits around 9 MB. The real memory pressure on a box this size comes from everything else — package updates, a stray journalctl without --no-pager, or a log rotation that compresses a large file. A 512 MB swap file has saved me twice.
TLS
HTTP/2 and TLS 1.3 only for modern clients, 1.2 kept for older ones. Session tickets off, session cache on. Certificates come from Let's Encrypt and renew through a systemd timer — see the note on timers.