Ubuntu Tips
Practical notes on provisioning, tuning and hardening Ubuntu servers.
This site collects the parts of running Ubuntu servers that are easy to get subtly wrong: tuning values that only matter under load, hardening steps that are worth doing once, and the occasional script that saves an afternoon.
29 posts so far. Everything is Markdown in a git repository.
New here? Start with the setup-script guide or why this site is static.
Pinned: One idempotent script for the whole Ubuntu web stack
Angie, PHP-FPM, MariaDB, Valkey and Elasticsearch from a single Bash entry point: every command, option and safety rule in one place.

One error page, compiled into nginx
My setup script now builds nginx with its own 401, 403, 404 and 50x page: neutral, 1.3 KB, light and dark, with a Home and a Try again button. It needs no configuration, still shows when PHP-FPM is down, is gzipped once at build time instead of on every request, and sends 502 and 504 as 503 so Cloudflare stops replacing it with its own page.

Upgrade Ubuntu first, and survive a dead mirror
My setup script now runs the full apt upgrade before it compiles anything, on a fresh install and on every --optimize, without restarting a single service. A failed test install led to the second half: apt's own mirror+file: method, so a mirror that answers 503 is simply skipped. The same week removed about 11,000 lines after a read-only check of every live server, and stopped a 20-second file walk through forum attachments.

Whitespace is cheap: the nginx trim filter lost, and five setup options became automatic
I built Tengine's HTML trim filter into my compiled nginx and measured it on a seeded XenForo forum. It made member pages 7-10 % smaller and every PHP-rendered page 1.6-3 % slower, so it did not ship. The same release of my setup script turns five command-line options into values derived from the hardware, shows what --optimize is compiling and why, closes a root chown race in a nightly cron job, and tightens the XenForo guest cache.

The MariaDB query cache earned its place back, and 14,000 lines of migration code left
With every server on 1.22, my setup script dropped the one-time migration from Angie, Sury PHP and packaged Redis/Valkey: about 14,200 lines, guarded by a check that refuses any host still in the old state. The same cycle tested nine performance ideas across MariaDB, PHP and the kernel. One won: the MariaDB query cache, 9-11 % faster on every uncached XenForo page, even with a writer posting twice a second. Six lost, and the numbers are here.
