Draft commented on Nov 25, 2026
Related posts
- Angie, nginx, FreeNginx, OpenResty, Tengine or Caddy? The cache decides
Six web servers, one PHP-FPM pool, three real applications and the same load generator. The event loop is not what separates them; a generic full-page cache is, and stock Caddy does not have one.
- Compiling Valkey, and the BOLT flag that gave my binaries an executable stack
Valkey from source was 35 % slower until I stopped passing CFLAGS on make's command line. Then its unit refused the BOLTed binary, which exposed an executable stack in my compiled PHP and Angie too. Plus nginx vs Angie, compiled the same way.
- Why my from-source PHP was slower, and the one-line answer: ICU
A from-source php-fpm executed 9 % fewer instructions per page than a clang build using Sury's extensions, yet ran 1-2 % slower. The cause was ICU: the intl extension made the binary 102 MB and multiplied data-TLB misses by 4.5. Without it, the merged build is the fastest: +11 % on logged-in XenForo pages.
The last post ended with compiled nginx edging out compiled Angie by 0.5-1.5 % on cached pages. That was enough to change the plan. Version 1.22.0 of my setup script installs no web server, PHP or Valkey packages at all. nginx comes from the latest nginx.org mainline, PHP (FPM and CLI) from php.net, and Valkey from its release tarball. All three are compiled with the same clang, LTO and BOLT recipe as before. MariaDB and Elasticsearch stay packages, because compiling them measured not worth it.
Fewer moving parts was the point. There is one way to install each service, with no package mode to keep working beside it.
What a server gets now#
Serverheader is gone, and so is the<hr><center>nginx</center>line on error pages. The build checks how many lines its patch changed and refuses a tarball where it no longer applies.--php ext=.valkey-serverpackage. A plain--optimizeon an older server migrates it once.Migrating a live server#
The migration does PHP first, then Valkey, then nginx. Each part rolls back on its own if the new service does not answer for every site the old one served. Packages are purged only after the compiled service has served. Angie configurations that used its ACME module move to the origin’s self-signed certificate, which is what Cloudflare’s Full mode expects anyway.
I ran it on a copy of a 1.21 server with three apps, an ACME vhost and an
auth_basicvhost. It stopped three times, and each time Angie went on serving:Host: localhostto answer like Angie’s welcome page.After the fixes, the migration finished, the security and cookie suites passed, and the server survived a reboot.
A 1.7 TB build log#
Then I tried
--upgrade-php=8.6. The build failed, safely: igbinary does not compile on PHP 8.6 yet, so 8.5 kept serving. Fifteen minutes later, MariaDB was down with a full disk.The build tool prints the last lines of its log when a step fails, with
tail log >&2. My script runs that tool with stderr appended to the same log, sotailkept reading what it was writing and never reached the end. Now the excerpt is skipped when stderr is the log, and every build runs underulimit -f, so no single file can grow past 20 GB.Down to PHP 8.1#
To see how far down
--upgrade-phpgoes, I walked a host from 8.5 to 8.1 and back. Every step either worked or failed with the old version still serving. It found four more bugs:-fuse-ld=lldon some links, so clang fell back to GNU ld, which cannot handle the ThinLTO objects. The build now runs clang through a tiny driver that adds lld to every link./index.php, which nginx answers with a redirect without ever running PHP. It now loads each home page.PHP 8.0 is refused outright: it has had no security fixes since 2023 and does not build against OpenSSL 3. Switching back to the previous version takes about 40 seconds, because one build is always kept for rollback.
One day later: no more pre-compressed files#
In 1.22.1 nginx dropped
gzip_staticandbrotli_static, along with the job that kept.brand.gzcopies of every static file beside it. Every response is now compressed on the fly with gzip or Brotli.Two more bugs turned up while testing that release:
--optimize. One that still saidgzip_static on;passed when nginx was rebuilt, but a vhost added afterwards stopped the run atnginx -t. Now every run comments such a line out and reports it.1.22.1 is out, and the mirror now keeps a copy of every source tarball these builds download, nginx signatures included.