Iron Ladder

nginx on a 512 MB box

2026-08-27 · nginx, vps

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;
}

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.