{"authors":[{"name":"Draft","url":"https://ubuntips.com/about/"}],"description":"Practical notes on provisioning, tuning and hardening Ubuntu servers.","favicon":"https://ubuntips.com/img/icon-48.png","feed_url":"https://ubuntips.com/feed.json","home_page_url":"https://ubuntips.com/","icon":"https://ubuntips.com/img/icon-512.png","items":[{"content_html":"\u003cp\u003eXenForo can store its cache in Redis or Valkey in two ways. The core provider needs the \u003ccode\u003ephp-redis\u003c/code\u003e extension. The popular SV RedisCache add-on ships its own pure-PHP client (Credis) and works with no extension at all. I wanted to know whether \u003ccode\u003ephp-redis\u003c/code\u003e is worth making a hard requirement for every XenForo server, so I measured it.\u003c/p\u003e\n\u003cp\u003eShort answer: no. On the forum, thread and mixed pages the two clients are within about 2% of each other, with the database on the same box or on a simulated remote server. The only larger gaps came from single noisy rounds, and they favoured the pure-PHP client. What matters is that the cache is on, and that the SV add-ons are installed.\u003c/p\u003e\n\u003ch2 id=\"the-six-setups\" class=\"heading-anchor\"\u003eThe six setups\u003ca class=\"anchor\" href=\"#the-six-setups\" aria-label=\"Link to section: The six setups\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eSetup\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003ePHP extensions\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eCache provider\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eSerializer\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eSV add-ons\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eA\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eredis + igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eSV RedisCache, using phpredis\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eigbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eRedisCache, RedisFloodCheck, RedisViewCounter\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eA+\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eredis + igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003esame as A, persistent connections\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eigbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eall three\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eB\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eigbinary only\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eSV RedisCache, pure-PHP Credis\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eigbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eall three\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eC\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enone\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eSV RedisCache, pure-PHP Credis\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ePHP \u003ccode\u003eserialize\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eall three\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eredis + igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eXenForo core \u003ccode\u003e'provider' =\u0026gt; 'Redis'\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eigbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003edisabled\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eE\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enone\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ecache off\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003en/a\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003einstalled, no backend\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eC is the \u0026ldquo;no extensions\u0026rdquo; setup that many forums already run. Every other result below is compared against it.\u003c/p\u003e\n\u003ch2 id=\"test-bed\" class=\"heading-anchor\"\u003eTest bed\u003ca class=\"anchor\" href=\"#test-bed\" aria-label=\"Link to section: Test bed\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eOne dedicated server: 6-core / 12-thread Xeon, 62 GB RAM, Ubuntu 26.04.\u003c/li\u003e\n\u003cli\u003eAngie, PHP-FPM 8.5 (\u003ccode\u003epm = static\u003c/code\u003e, 12 children), MariaDB, and Valkey on a Unix socket. Everything was installed and tuned by the same \u003ca href=\"/posts/one-idempotent-script/\"\u003eprovisioning script used for these notes\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eXenForo 2.3.13 filled with generated content. SV StandardLib, RedisCache 2.18.12, RedisFloodCheck and RedisViewCounter were installed.\u003c/li\u003e\n\u003cli\u003e64 logged-in members, picked at random on every request, reading 300 threads and 47 forums. Read state was pre-warmed so it did not grow during the runs.\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/wg/wrk\"\u003ewrk\u003c/a\u003e at 24 connections for 20 seconds, for four page types: home, thread, forum list, and a mixed set. Two single-connection runs (\u003ccode\u003ethread-c1\u003c/code\u003e, \u003ccode\u003ehome-c1\u003c/code\u003e) measured plain page latency.\u003c/li\u003e\n\u003cli\u003eSetups were run in rotated order across rounds: 3 rounds for the local and 0.9 ms databases, 2 for the others. All figures are medians.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eI only measured logged-in traffic. That is the traffic that always reaches PHP and the cache, while guest pages can be served from the web server\u0026rsquo;s page cache.\u003c/p\u003e\n\u003ch3 id=\"keeping-each-setup-honest\" class=\"heading-anchor\"\u003eKeeping each setup honest\u003ca class=\"anchor\" href=\"#keeping-each-setup-honest\" aria-label=\"Link to section: Keeping each setup honest\"\u003e#\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003eCache benchmarks are easy to fool, so the harness did this before every setup:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eWrite a neutral config, toggle the add-ons, then install or remove the PHP packages.\u003c/li\u003e\n\u003cli\u003eWrite the setup\u0026rsquo;s config, restart PHP-FPM, flush the cache database and drain XenForo\u0026rsquo;s job queue.\u003c/li\u003e\n\u003cli\u003eLog all 64 members back in.\u003c/li\u003e\n\u003cli\u003eCheck that the expected FPM modules are loaded, that most keys in a sample of up to 150 use the expected serializer, and that the SV add-ons are in the expected state. A setup that failed any check was skipped. None did.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eThe XenForo cron job was disabled while measuring, so background jobs could not land in one setup\u0026rsquo;s numbers. All 300 timed runs completed with zero errors. In a separate functional pass, each setup also posted a forum reply (HTTP 200) with no XenForo error-log entries and no PHP log lines.\u003c/p\u003e\n\u003ch3 id=\"simulating-a-remote-mariadb\" class=\"heading-anchor\"\u003eSimulating a remote MariaDB\u003ca class=\"anchor\" href=\"#simulating-a-remote-mariadb\" aria-label=\"Link to section: Simulating a remote MariaDB\"\u003e#\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003eSome large forums run MariaDB on a separate server. To approximate that on one box, XenForo connected over TCP to \u003ccode\u003e127.0.0.1\u003c/code\u003e, and \u003ccode\u003etc netem\u003c/code\u003e delayed only MariaDB traffic on the loopback interface:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003etc qdisc add dev lo root handle 1: prio bands \u003cspan class=\"m\"\u003e4\u003c/span\u003e priomap \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003etc qdisc add dev lo parent 1:1 handle 10: netem delay 1000us\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003etc filter add dev lo parent 1: protocol ip prio \u003cspan class=\"m\"\u003e1\u003c/span\u003e u32 match ip dport \u003cspan class=\"m\"\u003e3306\u003c/span\u003e 0xffff flowid 1:1\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003etc filter add dev lo parent 1: protocol ip prio \u003cspan class=\"m\"\u003e1\u003c/span\u003e u32 match ip sport \u003cspan class=\"m\"\u003e3306\u003c/span\u003e 0xffff flowid 1:1\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe priomap sends all other loopback traffic to the fourth band, which has no delay, so only port-3306 traffic goes through netem. Remove it afterwards with \u003ccode\u003etc qdisc del dev lo root\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eBoth directions are delayed, so a 250 µs setting gave a measured \u003ccode\u003eSELECT 1\u003c/code\u003e median of \u003cstrong\u003e0.9 ms\u003c/strong\u003e, and 1,000 µs gave \u003cstrong\u003e2.2 ms\u003c/strong\u003e. Before each latency block, the harness measured the round trip (median of 500 \u003ccode\u003eSELECT 1\u003c/code\u003e queries) and aborted if it fell outside the expected range. A TCP run with no delay served as a control: TCP alone cost about 2% against the Unix socket. Persistent database connections (\u003ccode\u003ep:\u003c/code\u003e host prefix) were on in every run.\u003c/p\u003e\n\u003cp\u003eThis simulates network latency only. A real remote server also has its own CPU, disk and network jitter.\u003c/p\u003e\n\u003ch2 id=\"results\" class=\"heading-anchor\"\u003eResults\u003ca class=\"anchor\" href=\"#results\" aria-label=\"Link to section: Results\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThroughput relative to C, for the forum, thread and mixed pages:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eSetup\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eLocal socket\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eRemote, 0.9 ms\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eRemote, 2.2 ms\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eA (php-redis + igbinary)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+1.2 to +1.4%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e−0.1 to +1.0%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+0.1 to +0.7%\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eA+ (persistent)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+1.5 to +1.9%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+1.1 to +1.4%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enot run\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eB (igbinary only)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+1.0 to +1.6%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+0.7 to +1.1%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enot run\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eD (core provider, no SV)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+2.6 to +3.4%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e−0.8 to +0.1%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e−4.8 to −6.2%\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eE (no cache)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+2.8 to +4.4%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e−4.3 to −5.6%\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e−14.8 to −19.9%\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eRaw throughput for the mixed page set, in requests per second:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eSetup\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eLocal socket\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eRemote, 0.9 ms\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eRemote, 2.2 ms\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eA\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e332\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e272\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e173\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eC\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e329\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e273\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e171\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eD\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e337\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e272\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e161\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eE\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e338\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e260\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e143\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eWhat a remote database does to a thread page with setup C:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eMariaDB round trip\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eThread req/s\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eOne request at a time (p50)\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e0.03 ms (Unix socket)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e350\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e19.2 ms\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e0.9 ms\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e299\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e35.0 ms\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e2.2 ms\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e188\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e64.6 ms\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ch2 id=\"why-the-php-client-barely-matters\" class=\"heading-anchor\"\u003eWhy the PHP client barely matters\u003ca class=\"anchor\" href=\"#why-the-php-client-barely-matters\" aria-label=\"Link to section: Why the PHP client barely matters\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eA thread page makes about \u003cstrong\u003esix\u003c/strong\u003e cache calls. Here is the cost of one page, with the database on the local socket:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eSetup\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003ePHP CPU ms\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eValkey ms\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eValkey calls\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDB queries\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eA\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e25.89\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0.274\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e6.0\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e10.7\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eB\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e26.00\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0.272\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e6.0\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e10.7\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eC\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e26.26\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0.307\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e6.0\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e10.7\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eD\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e25.52\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0.272\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e6.0\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e11.7\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eE\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e25.73\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0.004\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e0\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e14.8\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003ephp-redis saves about \u003cstrong\u003e0.03 ms\u003c/strong\u003e of cache time per page, out of roughly 26 ms of PHP time. No client library can win much there.\u003c/p\u003e\n\u003cp\u003eA micro-benchmark of the two clients, run directly against the Valkey socket (median of 3 runs, µs per operation):\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eOperation\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003ephpredis\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eCredis\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eGET + unserialize, PHP serializer\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e35.5\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e37.6\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eGET + unserialize, igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e20.3\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e22.5\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eMGET × 20, PHP serializer\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e55.1\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e63.2\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eMGET × 20, igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e28.3\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e35.3\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSET, igbinary\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e13.4\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e15.1\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003econnect + PING + close\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e28.5\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e31.5\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eThe serializer matters more than the client. igbinary nearly halves read cost with either library, and it shrank the sample cache entry from 7,907 bytes to 1,965. phpredis is only about 2 to 8 µs faster per call.\u003c/p\u003e\n\u003ch2 id=\"why-the-cache-matters-more-with-a-remote-database\" class=\"heading-anchor\"\u003eWhy the cache matters more with a remote database\u003ca class=\"anchor\" href=\"#why-the-cache-matters-more-with-a-remote-database\" aria-label=\"Link to section: Why the cache matters more with a remote database\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eOn the Unix socket a query costs almost nothing. Skipping the cache saves a little PHP work, so the no-cache setup (E) actually comes out about 3% ahead.\u003c/p\u003e\n\u003cp\u003eThe cache removes about four queries per page (14.8 down to 10.7). Once each query crosses a network, every one avoided saves a round trip. At 0.9 ms the cache is worth 4 to 6% of throughput. At 2.2 ms it is worth 15 to 20%, and single-request latency is up to 21% better.\u003c/p\u003e\n\u003cp\u003eThe SV add-ons show the same pattern. XenForo\u0026rsquo;s core provider (D) uses php-redis but drops the SV flood-check and view-counter add-ons, and adds about one query per page. With a local database that is free. At 2.2 ms D falls about 5 to 6% behind C on the forum, thread and mixed pages.\u003c/p\u003e\n\u003ch2 id=\"one-false-alarm\" class=\"heading-anchor\"\u003eOne false alarm\u003ca class=\"anchor\" href=\"#one-false-alarm\" aria-label=\"Link to section: One false alarm\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe first home-page run with the 0.9 ms database showed 18.4 queries per request instead of the usual 14.3, which looked like a TCP-only code path. The three-round median for that page was back at 14.3, the same as over the local socket. It was a cold first pass after the switch, which is a good reason never to trust a single run.\u003c/p\u003e\n\u003ch2 id=\"what-this-does-not-prove\" class=\"heading-anchor\"\u003eWhat this does not prove\u003ca class=\"anchor\" href=\"#what-this-does-not-prove\" aria-label=\"Link to section: What this does not prove\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe result is narrow, and it is worth being explicit about where it stops:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eOne forum shape.\u003c/strong\u003e Generated content, 64 logged-in members and 300 threads exercise the cache paths but not your add-on mix. A forum with heavy search, reactions or a chat add-on makes more queries per page, which changes how much the cache is worth.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eOne host.\u003c/strong\u003e CPU, RAM and disk were constant across setups, so the comparison isolates the cache clients. It says nothing about how the numbers scale down to a 2-vCPU VPS, where PHP time dominates even more.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eOne database location.\u003c/strong\u003e The remote cases simulate latency with \u003ccode\u003etc netem\u003c/code\u003e and nothing else. A real remote database also adds CPU contention, connection resets and jitter.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eGuest traffic is excluded.\u003c/strong\u003e Guests can be served from the web server\u0026rsquo;s page cache, where PHP and the cache barely appear. The interesting case is members, so that is what was measured.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThroughput, not tail latency.\u003c/strong\u003e Median throughput over 20-second runs shows saturation behaviour. It is not a p99 study, and a cache miss storm under a cold start can look different.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eNone of that changes the conclusion for a typical XenForo host — the client choice is noise next to whether the cache exists — but it is the boundary of the claim.\u003c/p\u003e\n\u003ch2 id=\"choosing-a-setup\" class=\"heading-anchor\"\u003eChoosing a setup\u003ca class=\"anchor\" href=\"#choosing-a-setup\" aria-label=\"Link to section: Choosing a setup\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eYour situation\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eSensible default\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eFresh host, no existing XenForo config\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eSV RedisCache with \u003ccode\u003ephp-igbinary\u003c/code\u003e, no \u003ccode\u003ephp-redis\u003c/code\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003econfig.php\u003c/code\u003e selects the core \u003ccode\u003eRedis\u003c/code\u003e provider\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eInstall \u003ccode\u003ephp-redis\u003c/code\u003e; the core provider requires it\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eDatabase on a separate server\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eKeep the cache on, keep the SV add-ons, and treat database latency as the first thing to fix\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eCache memory is the constraint\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAdd \u003ccode\u003ephp-igbinary\u003c/code\u003e; it cut a sample entry roughly 4×\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eYou are unsure what your host does now\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eMeasure the database round trip and the cache hit path before changing anything\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ch2 id=\"what-i-changed\" class=\"heading-anchor\"\u003eWhat I changed\u003ca class=\"anchor\" href=\"#what-i-changed\" aria-label=\"Link to section: What I changed\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eNothing, and that is the result. My provisioning script already:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003einstalls neither \u003ccode\u003ephp-redis\u003c/code\u003e nor \u003ccode\u003ephp-igbinary\u003c/code\u003e on a fresh server;\u003c/li\u003e\n\u003cli\u003einstalls \u003ccode\u003ephp-redis\u003c/code\u003e only when a XenForo \u003ccode\u003econfig.php\u003c/code\u003e selects the core Redis provider, the one case that actually needs it.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eIf you run XenForo with a separate database server:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003cstrong\u003eKeep a cache on.\u003c/strong\u003e SV RedisCache on a local Valkey socket is worth up to a fifth of your throughput at 2 ms database latency.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eKeep the SV add-ons.\u003c/strong\u003e They remove database work the core provider does not.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDon\u0026rsquo;t install php-redis for speed.\u003c/strong\u003e A 0 to 2% difference is inside normal run-to-run noise.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eAdd php-igbinary if cache memory matters.\u003c/strong\u003e It cuts the size of cache entries about 4× and needs no php-redis. Otherwise it is optional.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMeasure your own database round trip.\u003c/strong\u003e Going from 0.9 ms to 2.2 ms cost more throughput than any cache choice here. Keeping the database server close to the web server is the biggest win available.\u003c/li\u003e\n\u003c/ol\u003e\n","date_modified":"2026-11-21T15:21:28+08:00","date_published":"2026-11-21T14:45:00+08:00","id":"https://ubuntips.com/posts/xenforo-valkey-php-redis-vs-sv-rediscache/","summary":"Six XenForo cache setups, 300 load-test runs, MariaDB local and simulated remote. The PHP extension barely matters; the cache itself does.","tags":["Xenforo","Valkey","Redis","Php","Mariadb","Benchmark"],"title":"XenForo on Valkey: do you need php-redis?","url":"https://ubuntips.com/posts/xenforo-valkey-php-redis-vs-sv-rediscache/"},{"content_html":"\u003cp\u003eMost of the notes on this site started as comments in a shell script.\u003c/p\u003e\n\u003cp\u003eProvisioning an Ubuntu host is not hard, but it is full of decisions that are easy to get subtly wrong: the PHP-FPM process manager that looks fine at idle and collapses under load, the MariaDB buffer pool sized for a machine you no longer run, the sysctl values that only matter at 10,000 requests per second. Once you have worked them out, you write them down somewhere.\u003c/p\u003e\n\u003cp\u003eThis blog is that \u0026ldquo;somewhere\u0026rdquo;. It is also an experiment in publishing: everything here is Markdown in a git repository, rendered by Hugo, and served as static files. No database, no admin panel, no plugin updates. The \u003ca href=\"/posts/why-this-blog-is-a-static-site/\"\u003enext post\u003c/a\u003e explains that decision in detail.\u003c/p\u003e\n\u003ch2 id=\"what-gets-published\" class=\"heading-anchor\"\u003eWhat gets published\u003ca class=\"anchor\" href=\"#what-gets-published\" aria-label=\"Link to section: What gets published\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe posts fall into four rough categories:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eTuning notes.\u003c/strong\u003e Why a value is what it is, what it costs, and how to check that it actually applied. A number without a verification step is a rumour.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eBuild and provisioning.\u003c/strong\u003e The design of the \u003ca href=\"https://github.com/droplinxuser/ubuntu-setup-script\"\u003esetup script\u003c/a\u003e that installs and tunes the whole stack, including the parts that exist only to make reruns safe.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eBenchmarks with a method.\u003c/strong\u003e Load tests are easy to make look convincing. Posts that include numbers also include the test bed, the order the setups ran in, and what was done to keep each run honest.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ePost-mortems.\u003c/strong\u003e The change that looked safe in a dry run, the package that silently changed a default, the \u0026ldquo;optimisation\u0026rdquo; that was inside noise.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eExpect the occasional opinion, but the useful parts are the commands, the configuration, and the measurements.\u003c/p\u003e\n\u003ch2 id=\"how-the-numbers-are-made\" class=\"heading-anchor\"\u003eHow the numbers are made\u003ca class=\"anchor\" href=\"#how-the-numbers-are-made\" aria-label=\"Link to section: How the numbers are made\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eBenchmarks on this site come from one dedicated host: a 6-core/12-thread Xeon with 62 GB of RAM running Ubuntu 26.04, with Angie, PHP-FPM, MariaDB and Valkey installed and tuned by the same script the posts describe. Content is generated, the load generator is \u003ca href=\"https://github.com/wg/wrk\"\u003ewrk\u003c/a\u003e, and run order is rotated so one setup does not always get the warm cache.\u003c/p\u003e\n\u003cp\u003eTwo rules apply to every post with a table of results:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003cstrong\u003eMedians, not best runs.\u003c/strong\u003e Single runs are treated as anecdotes, because they are. One early home-page result in the XenForo post was 30% off until the three-round median brought it back in line.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eState the limits.\u003c/strong\u003e A benchmark that simulates a remote database with \u003ccode\u003etc netem\u003c/code\u003e measures network latency and nothing else. It does not reproduce a remote server\u0026rsquo;s CPU, disk or jitter. Saying so is part of the result.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eWhere a claim cannot be measured on this hardware, the post says so rather than extrapolating.\u003c/p\u003e\n\u003ch2 id=\"how-the-site-is-built\" class=\"heading-anchor\"\u003eHow the site is built\u003ca class=\"anchor\" href=\"#how-the-site-is-built\" aria-label=\"Link to section: How the site is built\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe workflow is deliberately boring:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e# write a post\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003ehugo new content posts/some-topic.md\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e# preview\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003ehugo server\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e# publish\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003egit add -A \u003cspan class=\"o\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e git commit -m \u003cspan class=\"s2\"\u003e\u0026#34;post: some topic\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e git push\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eA push to \u003ccode\u003emain\u003c/code\u003e triggers GitHub Actions, which builds the site and deploys it to GitHub Pages. Social cards, sitemap and structured data are generated in the same run. The whole build takes seconds, and the published output is a directory of HTML, CSS and images.\u003c/p\u003e\n\u003cp\u003eThis also means the site has no runtime to patch. There is no login to brute-force, no query string to inject into, and no upload directory to leave executable. For a blog about server hardening, that felt like the minimum bar.\u003c/p\u003e\n\u003ch2 id=\"what-you-will-not-find\" class=\"heading-anchor\"\u003eWhat you will not find\u003ca class=\"anchor\" href=\"#what-you-will-not-find\" aria-label=\"Link to section: What you will not find\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eComments.\u003c/strong\u003e If you want to reply, email or open an issue on the repository. Moderation queues are a hobby I am not taking up.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eA newsletter popup.\u003c/strong\u003e The \u003ca href=\"/index.xml\"\u003eRSS feed\u003c/a\u003e is the subscription mechanism.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eTracking scripts.\u003c/strong\u003e No analytics, no third-party fonts, no embeds that phone home.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eSponsored posts.\u003c/strong\u003e If that ever changes, the post will say so at the top.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"corrections\" class=\"heading-anchor\"\u003eCorrections\u003ca class=\"anchor\" href=\"#corrections\" aria-label=\"Link to section: Corrections\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eIf a command is wrong, a value is stale, or a measurement does not reproduce, the fix is a pull request or an issue on the repository. Posts are versioned in git, so the history of a correction is public, which is more than most blogs can say.\u003c/p\u003e\n\u003ch2 id=\"following-along\" class=\"heading-anchor\"\u003eFollowing along\u003ca class=\"anchor\" href=\"#following-along\" aria-label=\"Link to section: Following along\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eSubscribe to the \u003ca href=\"/index.xml\"\u003eRSS feed\u003c/a\u003e and you will get new posts without an algorithm deciding what you see. Start with \u003ca href=\"/posts/why-this-blog-is-a-static-site/\"\u003ewhy this blog is a static site\u003c/a\u003e and \u003ca href=\"/posts/one-idempotent-script/\"\u003ethe one idempotent script\u003c/a\u003e if you want the two ideas the rest of the site builds on.\u003c/p\u003e\n","date_modified":"2026-11-21T15:21:28+08:00","date_published":"2026-11-21T09:00:00+08:00","id":"https://ubuntips.com/posts/introducing-ubuntu-tips/","summary":"A place to write down the things that took too long to figure out the first time.","tags":["Meta"],"title":"Introducing Ubuntu Tips","url":"https://ubuntips.com/posts/introducing-ubuntu-tips/"},{"content_html":"\u003cp\u003eA blog about hardening servers should not itself be the softest target in the stack. That ruled out the obvious choice.\u003c/p\u003e\n\u003ch2 id=\"the-requirements\" class=\"heading-anchor\"\u003eThe requirements\u003ca class=\"anchor\" href=\"#the-requirements\" aria-label=\"Link to section: The requirements\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe site needed to do five things:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003epublish Markdown posts with syntax highlighting and tables,\u003c/li\u003e\n\u003cli\u003eload fast on a phone over a mediocre connection,\u003c/li\u003e\n\u003cli\u003ehave nothing that needs a security patch on a Tuesday night,\u003c/li\u003e\n\u003cli\u003ecost approximately nothing to run,\u003c/li\u003e\n\u003cli\u003ekeep every post in git, so a local agent or a shell script can edit it as easily as a person.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThat last point matters more than it sounds. If the source of truth is a database, every change has to go through an API, an admin session or a migration. If it is a directory of text files, an editor, a script and a coding agent all work the same way.\u003c/p\u003e\n\u003ch2 id=\"what-a-conventional-blog-engine-costs\" class=\"heading-anchor\"\u003eWhat a conventional blog engine costs\u003ca class=\"anchor\" href=\"#what-a-conventional-blog-engine-costs\" aria-label=\"Link to section: What a conventional blog engine costs\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eA typical CMS stack is a language runtime, a database, a web admin, a plugin ecosystem and a theme. Each of those is a component that can be exploited, and each has its own release cadence:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eComponent\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eTypical failure mode\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eRuntime (PHP, Node)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eRCE in a dependency reachable from a request path\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eDatabase\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eCredential leak, SQL injection, unpatched service exposed on a socket\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eAdmin panel\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eBrute force, stolen session, vulnerable plugin endpoint\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eUpload directory\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eA file that ends in \u003ccode\u003e.php\u003c/code\u003e and gets executed\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003ePlugins and themes\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAbandoned code, supply-chain compromise\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSearch add-on\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eIndex corruption, another service to keep running\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eNone of this is hypothetical; it is the ordinary background noise of running WordPress. The response is a patch routine, a WAF and monitoring. For a blog that changes a few times a month, that is a lot of machinery protecting text.\u003c/p\u003e\n\u003ch2 id=\"what-a-static-site-removes\" class=\"heading-anchor\"\u003eWhat a static site removes\u003ca class=\"anchor\" href=\"#what-a-static-site-removes\" aria-label=\"Link to section: What a static site removes\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe published site is a directory of files. A request is a file read. Concretely, this site has:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eno database and no database credentials,\u003c/li\u003e\n\u003cli\u003eno login form, session cookie or password reset flow,\u003c/li\u003e\n\u003cli\u003eno upload endpoint and no writable web root,\u003c/li\u003e\n\u003cli\u003eno server-side includes, no template evaluated per request,\u003c/li\u003e\n\u003cli\u003eno third-party JavaScript, fonts, or analytics.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe attack surface is the CDN serving files, plus whatever is in this repository. A compromised post can change text; it cannot pivot into a database.\u003c/p\u003e\n\u003ch2 id=\"the-pipeline\" class=\"heading-anchor\"\u003eThe pipeline\u003ca class=\"anchor\" href=\"#the-pipeline\" aria-label=\"Link to section: The pipeline\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003ehugo.toml\u003c/code\u003e (site config, menus, output formats) plus \u003ccode\u003econtent/posts/*.md\u003c/code\u003e is the input. A push to \u003ccode\u003emain\u003c/code\u003e runs \u003ccode\u003e.github/workflows/pages.yml\u003c/code\u003e:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003einstall the pinned Hugo version,\u003c/li\u003e\n\u003cli\u003ebuild once to produce \u003ccode\u003epublic/index.json\u003c/code\u003e,\u003c/li\u003e\n\u003cli\u003erender a 1200×630 social card per post with headless Chrome,\u003c/li\u003e\n\u003cli\u003ebuild the final site (minified, fingerprinted assets),\u003c/li\u003e\n\u003cli\u003eupload the artifact and deploy it to GitHub Pages.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eThe build is a few seconds, and the same commands work locally:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003ehugo new content posts/some-topic.md   \u003cspan class=\"c1\"\u003e# from the archetype\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003ehugo server                            \u003cspan class=\"c1\"\u003e# http://localhost:1313\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003ehugo --minify --gc                     \u003cspan class=\"c1\"\u003e# what CI runs\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eBecause the output is static, rollbacks are trivial: revert the commit, push, and the previous version is live again in under a minute. There is no migration and no cache to flush beyond the CDN\u0026rsquo;s own.\u003c/p\u003e\n\u003ch2 id=\"search-without-a-server\" class=\"heading-anchor\"\u003eSearch without a server\u003ca class=\"anchor\" href=\"#search-without-a-server\" aria-label=\"Link to section: Search without a server\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eRemoving the database also removes the search backend, which is where most \u0026ldquo;you cannot do that statically\u0026rdquo; arguments start. Hugo can emit every post as JSON:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-json\" data-lang=\"json\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e \u003cspan class=\"nt\"\u003e\u0026#34;title\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;...\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"nt\"\u003e\u0026#34;url\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;/posts/...\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"nt\"\u003e\u0026#34;date\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;...\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"nt\"\u003e\u0026#34;tags\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"err\"\u003e...\u003c/span\u003e\u003cspan class=\"p\"\u003e],\u003c/span\u003e \u003cspan class=\"nt\"\u003e\u0026#34;markdown\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;...\u0026#34;\u003c/span\u003e \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThat file is fetched only when the search box is focused, then filtered in the browser. It is not a full-text index — it is a few kilobytes per post and a \u003ccode\u003eString.includes\u003c/code\u003e — but for a blog of this size it returns results instantly and has zero operational cost. At a few thousand posts you would move to a prebuilt index such as Pagefind; the rest of the pipeline would not change.\u003c/p\u003e\n\u003ch2 id=\"the-trade-offs-honestly\" class=\"heading-anchor\"\u003eThe trade-offs, honestly\u003ca class=\"anchor\" href=\"#the-trade-offs-honestly\" aria-label=\"Link to section: The trade-offs, honestly\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eStatic site\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eConventional CMS\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eNo in-browser editor by default\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eRich admin UI\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eRebuild required for every change\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eInstant publish\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eComments need a third party\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eBuilt in\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eNothing to patch\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ePatch treadmill\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSearch is client-side\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eSearch server included\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003ePreview is local or a branch deploy\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ePreview is built in\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eEach of those has a workaround: a git-based CMS for browser editing, a hosted comment service, Pagefind for search. What you cannot get back is the single-process simplicity of a CMS, where writing a post is one form submission.\u003c/p\u003e\n\u003ch2 id=\"caching-and-the-limit-of-github-pages\" class=\"heading-anchor\"\u003eCaching, and the limit of GitHub Pages\u003ca class=\"anchor\" href=\"#caching-and-the-limit-of-github-pages\" aria-label=\"Link to section: Caching, and the limit of GitHub Pages\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eAssets are minified and fingerprinted (\u003ccode\u003estyle.min.\u0026lt;hash\u0026gt;.css\u003c/code\u003e), so a deploy produces new URLs and no browser can serve stale CSS. That part is solved by the build.\u003c/p\u003e\n\u003cp\u003eResponse headers are not. GitHub Pages sends \u003ccode\u003ecache-control: max-age=600\u003c/code\u003e for everything and ignores \u003ccode\u003e_headers\u003c/code\u003e files. The repository still carries a \u003ccode\u003estatic/_headers\u003c/code\u003e with the policy this site wants — HTML revalidated, hashed assets immutable, images cached for a week — because it works unchanged on Cloudflare Pages. To get that policy in front of GitHub Pages you would proxy the DNS records through Cloudflare and add cache rules; the \u003ca href=\"https://github.com/droplinxuser/ubuntips\"\u003eREADME\u003c/a\u003e describes both paths.\u003c/p\u003e\n\u003cp\u003eIt is worth being precise about what that costs: ten minutes of cache lifetime on HTML, not a correctness problem. The fingerprinted asset names mean the worst case is a slightly stale homepage, not a broken stylesheet.\u003c/p\u003e\n\u003ch2 id=\"when-a-static-site-is-the-wrong-choice\" class=\"heading-anchor\"\u003eWhen a static site is the wrong choice\u003ca class=\"anchor\" href=\"#when-a-static-site-is-the-wrong-choice\" aria-label=\"Link to section: When a static site is the wrong choice\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThis setup is a bad fit if any of these are true:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eNon-technical authors.\u003c/strong\u003e If nobody on the team wants to touch git, a CMS is the honest answer.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eFrequent, tiny edits.\u003c/strong\u003e Rebuilding and pushing for a typo fix is fine; doing it fifty times a day is not.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ePer-user content.\u003c/strong\u003e Comments, memberships, dashboards and personalisation need a runtime.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eSearch over a large corpus.\u003c/strong\u003e Client-side filtering stops scaling; you need an index service.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eA publication with a workflow.\u003c/strong\u003e Draft review, scheduled publishing and roles are all things a CMS already solved.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"what-it-costs-to-run\" class=\"heading-anchor\"\u003eWhat it costs to run\u003ca class=\"anchor\" href=\"#what-it-costs-to-run\" aria-label=\"Link to section: What it costs to run\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eGitHub Pages serves the site and the certificate for free. The repository holds the source; Actions builds it. There is no VPS, no database volume, no backup job — the backup is \u003ccode\u003egit clone\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe failure modes are equally small: a bad build fails before deploy, a bad deploy is reverted with one commit, and if the host disappeared tomorrow the whole site would be rebuildable from the repository in minutes.\u003c/p\u003e\n\u003cp\u003eThat is the trade: a little friction when publishing, in exchange for almost nothing to operate. For a blog that is mostly read rather than written, it is the right side of the deal.\u003c/p\u003e\n","date_modified":"2026-11-21T15:21:28+08:00","date_published":"2026-11-20T18:30:00+08:00","id":"https://ubuntips.com/posts/why-this-blog-is-a-static-site/","summary":"No database, no admin panel, nothing to patch. Here is the trade-off.","tags":["Hugo","Static-Site","Security"],"title":"Why this blog is a static site","url":"https://ubuntips.com/posts/why-this-blog-is-a-static-site/"},{"content_html":"\u003cp\u003eThe setup script behind most of these notes has one rule: every run must be safe to repeat. That constraint shapes the whole design, and it is the part most provisioning scripts get wrong.\u003c/p\u003e\n\u003cp\u003eThis post is the long version of the script\u0026rsquo;s README: what it installs, what each flag does, what it refuses to touch, and how to verify a host afterwards. The source is at \u003ca href=\"https://github.com/droplinxuser/ubuntu-setup-script\"\u003edroplinxuser/ubuntu-setup-script\u003c/a\u003e.\u003c/p\u003e\n\u003ch2 id=\"why-idempotence-is-the-hard-part\" class=\"heading-anchor\"\u003eWhy idempotence is the hard part\u003ca class=\"anchor\" href=\"#why-idempotence-is-the-hard-part\" aria-label=\"Link to section: Why idempotence is the hard part\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eA script that only has to work once can do almost anything: append to a file, create a user, restart a service, assume the default config is still there. The second run is where the trouble starts. Appending twice duplicates a directive. Creating a user that already exists may reset its groups. Restarting a service in the middle of a config write can leave it running on half a file.\u003c/p\u003e\n\u003cp\u003eThe usual failure is quieter than an error message. It is \u003cem\u003edrift\u003c/em\u003e: the server installed six months ago and patched twice no longer matches the one installed yesterday, and nothing in the repository describes the difference. The next person to touch it is guessing.\u003c/p\u003e\n\u003cp\u003eSo the script separates \u003cem\u003erecording\u003c/em\u003e from \u003cem\u003echanging\u003c/em\u003e, makes every write derived rather than appended, and gives every operation a preview.\u003c/p\u003e\n\u003ch2 id=\"requirements\" class=\"heading-anchor\"\u003eRequirements\u003ca class=\"anchor\" href=\"#requirements\" aria-label=\"Link to section: Requirements\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eItem\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDetail\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eOS\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eUbuntu \u003cstrong\u003e26.04 LTS or newer\u003c/strong\u003e for installs; \u003ccode\u003e--optimize\u003c/code\u003e, \u003ccode\u003e--upgrade-php\u003c/code\u003e, \u003ccode\u003e--diagnostics\u003c/code\u003e and \u003ccode\u003e--restart-all\u003c/code\u003e also accept 22.04 and 24.04\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eShell\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eBash 4.4+, root\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eNetwork\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eUbuntu, Angie, Sury, Elastic and NodeSource repositories, plus GitHub for the web-server config tree (or a local checkout)\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eResources\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eElasticsearch needs ~1.5 GB of disk plus its heap; MariaDB its buffer pool; PHP one static worker per \u003ccode\u003epm.max_children\u003c/code\u003e slot\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eA host can only run \u003cstrong\u003eone PHP-FPM version\u003c/strong\u003e at a time: Angie and the pool both use \u003ccode\u003e/run/php/php-fpm.sock\u003c/code\u003e. Changing versions is what \u003ccode\u003e--upgrade-php\u003c/code\u003e is for; \u003ccode\u003e--php ver=X\u003c/code\u003e is a first installation and refuses to replace a version that is already there.\u003c/p\u003e\n\u003ch2 id=\"the-command-surface\" class=\"heading-anchor\"\u003eThe command surface\u003ca class=\"anchor\" href=\"#the-command-surface\" aria-label=\"Link to section: The command surface\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--basic\u003c/code\u003e is required for every install, and all of its values are optional. Only the services named on the command line are touched.\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eCommand\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003ePurpose\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--basic [server=] [host=] [swap=] [time=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eOS baseline; required for every install\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--angie [anubis=yes|no]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAngie web server, config tree, optional Anubis bot filter\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--php [ver=] [children=] [max_requests=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ePHP-FPM\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--mariadb user= pass= [size=] [bind=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eMariaDB\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--valkey [ram=] [policy=] [io_threads=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eValkey cache\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--elastic [host=] [ram=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eElasticsearch\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--others ITEM... | all\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ehelper packages\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--domain DOMAIN [app=] [db=] [user=] [pass=] [sql=]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003evhost, certificate, optional database\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--optimize [anubis=yes|no]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003etune the OS and every installed service in place\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--upgrade-php=X.Y\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ereplace the installed PHP version in place\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--diagnostics\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ewrite a redacted, read-only report\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--restart-all\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eordered restart of every active service\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--purge [TARGET...]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003estop and disable services, restore recorded settings\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--dry-run\u003c/code\u003e / \u003ccode\u003e--check\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eprint the plan, change nothing; works with every command\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eA full install looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003esudo bash setup.sh \u003cspan class=\"se\"\u003e\\\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  --basic \u003cspan class=\"nv\"\u003eserver\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003ededi \u003cspan class=\"nv\"\u003ehost\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003eweb1.example.com \u003cspan class=\"nv\"\u003etime\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003eAsia/Manila \u003cspan class=\"nv\"\u003eswap\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003e8G \u003cspan class=\"se\"\u003e\\\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  --angie --php \u003cspan class=\"nv\"\u003ever\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003e8.5 \u003cspan class=\"se\"\u003e\\\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  --mariadb \u003cspan class=\"nv\"\u003euser\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003edemo \u003cspan class=\"nv\"\u003epass\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003etemp \u003cspan class=\"nv\"\u003esize\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003eauto \u003cspan class=\"nv\"\u003ebind\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003e127.0.0.1 \u003cspan class=\"se\"\u003e\\\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  --valkey --elastic \u003cspan class=\"nv\"\u003ehost\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003elocalhost \u003cspan class=\"nv\"\u003eram\u003c/span\u003e\u003cspan class=\"o\"\u003e=\u003c/span\u003e4g --others all\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u0026hellip;and a minimal one like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003esudo bash setup.sh --basic --angie --php\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"--basic\" class=\"heading-anchor\"\u003e\u003ccode\u003e--basic\u003c/code\u003e\u003ca class=\"anchor\" href=\"#--basic\" aria-label=\"Link to section: --basic\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eOption\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDefault\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eEffect\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eserver=dedi|vps\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eauto-detect\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003einstall-time hint; \u003ccode\u003ededi\u003c/code\u003e sets the \u003ccode\u003eperformance\u003c/code\u003e CPU governor. \u003ccode\u003e--optimize\u003c/code\u003e re-detects the class from the hardware\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003ehost=FQDN\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e\u0026lt;threads\u0026gt;c-\u0026lt;RAM\u0026gt;g-\u0026lt;storage\u0026gt;\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ehostname via \u003ccode\u003ehostnamectl\u003c/code\u003e; a repeat run without \u003ccode\u003ehost=\u003c/code\u003e keeps the current name\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eswap=SIZE\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eonly when total swap is 0 or below half of RAM\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/swapfile\u003c/code\u003e of exactly that size, capped at half of RAM\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003etime=REGION/CITY\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eAsia/Manila\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003etimezone; a repeat run without \u003ccode\u003etime=\u003c/code\u003e keeps the current zone\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003emitigations=off|on\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enot touched\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eadds/removes \u003ccode\u003emitigations=off\u003c/code\u003e in a managed GRUB drop-in; effective at the next reboot, and the run checks the generated boot menu actually carries it\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e\u003ccode\u003emitigations=off\u003c/code\u003e is measured and tempting, and it is also a real trade: it removes the kernel\u0026rsquo;s protection between local processes. The README is explicit that it belongs on hosts where only you run code — one key-only administrator, no shared hosting, no untrusted local users.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003e--basic\u003c/code\u003e changes hostname, resolver, sysctls, limits, firewall and timezone. The repository\u0026rsquo;s own advice is to test it on a disposable server first; that is not boilerplate.\u003c/p\u003e\n\u003ch2 id=\"angie\" class=\"heading-anchor\"\u003eAngie\u003ca class=\"anchor\" href=\"#angie\" aria-label=\"Link to section: Angie\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--angie [anubis=yes|no]\u003c/code\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eInstalls \u003ccode\u003eangie\u003c/code\u003e and \u003ccode\u003eangie-module-brotli\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eDeploys the configuration tree from a \u003cstrong\u003eseparate repository\u003c/strong\u003e (\u003ccode\u003eserver-configs-nginx\u003c/code\u003e) with its own deployer; \u003ccode\u003eCONFIG_SOURCE_DIR=/path\u003c/code\u003e uses a local checkout, \u003ccode\u003eCONFIG_REPO_URL\u003c/code\u003e/\u003ccode\u003eCONFIG_REPO_REF\u003c/code\u003e select a fork or branch.\u003c/li\u003e\n\u003cli\u003eApplies the hardware profile and guest caches through the same \u003ccode\u003eangie_apply_profile\u003c/code\u003e that \u003ccode\u003e--optimize\u003c/code\u003e uses.\u003c/li\u003e\n\u003cli\u003eShips systemd \u003ccode\u003eLimitNOFILE\u003c/code\u003e and \u003ccode\u003e/etc/default/angie\u003c/code\u003e, generates \u003ccode\u003ehttp.d/cloudflare.conf\u003c/code\u003e, restarts the service.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eGuest caches for WordPress and XenForo report their state in a single \u003ccode\u003eX-Cache-Status\u003c/code\u003e header (\u003ccode\u003eHIT\u003c/code\u003e, \u003ccode\u003eMISS\u003c/code\u003e, \u003ccode\u003eBYPASS\u003c/code\u003e, \u003ccode\u003eEXPIRED\u003c/code\u003e). Cached locations disable per-hit AIO and Brotli on purpose: the body is already compressed, so re-running either filter only costs CPU.\u003c/p\u003e\n\u003cp\u003eAn upstream that a deployed vhost still references but the canonical tree no longer defines is preserved in \u003ccode\u003ehttp.d/zz-setup-preserved-upstreams.conf\u003c/code\u003e instead of letting \u003ccode\u003eangie -t\u003c/code\u003e fail with \u0026ldquo;host not found in upstream\u0026rdquo;. The include is regenerated each run and retired once the repository defines the name again.\u003c/p\u003e\n\u003ch3 id=\"anubis-optionally\" class=\"heading-anchor\"\u003eAnubis, optionally\u003ca class=\"anchor\" href=\"#anubis-optionally\" aria-label=\"Link to section: Anubis, optionally\"\u003e#\u003c/a\u003e\u003c/h3\u003e\n\u003cp\u003e\u003ccode\u003e--angie anubis=yes\u003c/code\u003e puts a bot filter in front of every site. It is not installed unless asked for, works on fresh and existing hosts, and \u003ccode\u003e--optimize anubis=no\u003c/code\u003e restores direct TLS, removes the generated Angie files and stops/disables the service while keeping the binary for a fast re-enable.\u003c/p\u003e\n\u003ch2 id=\"php-fpm\" class=\"heading-anchor\"\u003ePHP-FPM\u003ca class=\"anchor\" href=\"#php-fpm\" aria-label=\"Link to section: PHP-FPM\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eOption\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDefault\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eEffect\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003ever=X.Y\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003enewest Sury build\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eversion to install\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003echildren=auto|N\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eauto\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003epm.max_children\u003c/code\u003e; an explicit value wins\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003emax_requests=N\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ethreads × 1024\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003erecycle a worker after N requests\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eThe pool is always \u003ccode\u003epm = static\u003c/code\u003e. The worker count is logical CPUs × a factor chosen by storage and topology:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eSituation\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eWorkers per CPU\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eLocal MariaDB on flash\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e1.0\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eShared/virtual CPU, or a remote database\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e1.5\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSpinning disks\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e2.0\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eThat is then capped by the shared-memory plan (at most RAM/2 at 96 MB per worker, 512 maximum). The measured advice is blunt: on the 16-thread audit host, 16 workers did 834 req/s and 32 workers did 808 req/s — extra workers only contend for the same cores.\u003c/p\u003e\n\u003cp\u003eAlso managed: \u003ccode\u003erequest_terminate_timeout 300s\u003c/code\u003e, slow log at 10 s, \u003ccode\u003erlimit_files 524288\u003c/code\u003e, systemd \u003ccode\u003eLimitNOFILE=524288\u003c/code\u003e, \u003ccode\u003eUMask=0027\u003c/code\u003e, and \u003ccode\u003eKillSignal=SIGQUIT\u003c/code\u003e so a restart closes persistent MariaDB connections gracefully instead of logging \u0026ldquo;Aborted connection\u0026rdquo; warnings.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003ephp.ini\u003c/code\u003e gets \u003ccode\u003ememory_limit\u003c/code\u003e 256–512M (128M under 2 GB RAM), OPcache 128–512 MB with interned strings, a 4–16 MB realpath cache, and JIT \u003cstrong\u003ealways tracing\u003c/strong\u003e, with the buffer at OPcache/8. There is no JIT mode switch; an old \u003ccode\u003eSETUP_PHP_JIT\u003c/code\u003e value is ignored with a notice. Measured: tracing beat JIT-off by 5% on XenForo members, \u003ccode\u003efunction\u003c/code\u003e mode lost 6–8%, and a 256 MB buffer was slower than 64 or 128 MB.\u003c/p\u003e\n\u003cp\u003eExtensions default to the XenForo profile: \u003ccode\u003efpm cli opcache mysql gd curl xml zip gmp mbstring\u003c/code\u003e. \u003cstrong\u003eNo \u003ccode\u003eredis\u003c/code\u003e/\u003ccode\u003eigbinary\u003c/code\u003e by default\u003c/strong\u003e — XenForo runs on SV RedisCache\u0026rsquo;s pure-PHP client, and WordPress runs without an object-cache drop-in. \u003ccode\u003e--domain\u003c/code\u003e installs what an app cannot run without (Chevereto pulls \u003ccode\u003eredis\u003c/code\u003e/\u003ccode\u003eigbinary\u003c/code\u003e and \u003ccode\u003eimagick\u003c/code\u003e); \u003ccode\u003e--upgrade-php\u003c/code\u003e carries whatever the old version had.\u003c/p\u003e\n\u003cp\u003eThe PHP step also repairs the web server: \u003ccode\u003efastcgi_param PATH_TRANSLATED\u003c/code\u003e in every \u003ccode\u003eh5bp/php*.conf\u003c/code\u003e, and it comments out per-request \u003ccode\u003ePHP_ADMIN_VALUE open_basedir\u003c/code\u003e — PHP-FPM caches admin values per worker, so one vhost\u0026rsquo;s setting otherwise leaks onto every other vhost in the shared pool.\u003c/p\u003e\n\u003ch2 id=\"mariadb\" class=\"heading-anchor\"\u003eMariaDB\u003ca class=\"anchor\" href=\"#mariadb\" aria-label=\"Link to section: MariaDB\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eOption\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDefault\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eEffect\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003euser=U\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003erequired\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eadmin user for \u003ccode\u003elocalhost\u003c/code\u003e, \u003ccode\u003e127.0.0.1\u003c/code\u003e and \u003ccode\u003e::1\u003c/code\u003e (needed with \u003ccode\u003eskip_name_resolve\u003c/code\u003e)\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003epass=P\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003erequired\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ealso written to \u003ccode\u003e/etc/mysqlbkup.cnf\u003c/code\u003e, mode 600\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003esize=auto|4gb\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eauto\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ebuffer pool = live data+index +5%, 128 MB minimum, capped at 80% of RAM when MariaDB is the only data service, otherwise half\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003ebind=ADDR[,ADDR...]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e127.0.0.1\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eloopback by default; \u003ccode\u003eIPV4\u003c/code\u003e resolves the public address. TCP 3306 is never opened in the firewall\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eThe interesting part is \u003ccode\u003esize=auto\u003c/code\u003e. It measures the live data, so an empty database gets 128 MB and a database that grew gets a larger pool — and a pool that is more than one step above its target is shrunk online rather than holding RAM the data does not use. That is why the README tells you to run \u003ccode\u003e--optimize\u003c/code\u003e again after a large \u003ccode\u003esql=\u003c/code\u003e import: the plan is re-measured, not guessed.\u003c/p\u003e\n\u003cp\u003eThe hardware profile sets the redo log to a quarter of the pool, I/O capacity by disk type (NVMe 10000/20000, SSD 4000/8000, HDD 400/800), \u003ccode\u003ethread_handling=pool-of-threads\u003c/code\u003e, \u003ccode\u003emax_connections\u003c/code\u003e at PHP workers × 1.25 + 50, table caches, temp tables, \u003ccode\u003eflush_log_at_trx_commit=2\u003c/code\u003e, and slow/error logs under \u003ccode\u003e/var/www/logs/mariadb/\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eValidation matters more than any of these values: generated files are checked with \u003ccode\u003emariadbd --help --verbose\u003c/code\u003e before any restart. The install also embeds \u003ccode\u003emysqltuner.pl\u003c/code\u003e and a \u003ccode\u003emysqlbackup\u003c/code\u003e utility that keeps 30 dumps.\u003c/p\u003e\n\u003cp\u003eA less obvious base setting: \u003ccode\u003einnodb_snapshot_isolation = 0\u003c/code\u003e, so \u003ccode\u003eREPEATABLE READ\u003c/code\u003e keeps MySQL\u0026rsquo;s behaviour and XenForo does not hit MariaDB error 1020.\u003c/p\u003e\n\u003ch2 id=\"valkey\" class=\"heading-anchor\"\u003eValkey\u003ca class=\"anchor\" href=\"#valkey\" aria-label=\"Link to section: Valkey\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eOption\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eDefault\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eEffect\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eram=SIZE\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003edata +20%, 128 MB minimum\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003emaxmemory\u003c/code\u003e; an explicit value is used verbatim\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003epolicy=NAME\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eallkeys-lru\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003emaxmemory-policy\u003c/code\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eio_threads=N\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e1\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eextra socket I/O threads\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eManaged config: loopback \u003ccode\u003ebind\u003c/code\u003e, \u003ccode\u003eprotected-mode\u003c/code\u003e, a Unix socket at \u003ccode\u003e/run/valkey/valkey.sock\u003c/code\u003e (mode 770, \u003ccode\u003ewww-data\u003c/code\u003e in the \u003ccode\u003evalkey\u003c/code\u003e group), \u003ccode\u003esave \u0026quot;\u0026quot;\u003c/code\u003e, \u003ccode\u003eappendonly no\u003c/code\u003e, \u003ccode\u003emaxclients\u003c/code\u003e at PHP workers × 4 + 2000 (minimum 10000), and \u003ccode\u003ehz 10\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eTwo operational notes:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eWith \u003ccode\u003eredis-server\u003c/code\u003e installed, \u003ccode\u003e--valkey\u003c/code\u003e is \u003cstrong\u003eskipped with a warning\u003c/strong\u003e and \u003ccode\u003e--optimize\u003c/code\u003e tunes the existing Redis with the same profile. If both exist, Valkey wins.\u003c/li\u003e\n\u003cli\u003eRuntime values are applied with \u003ccode\u003eCONFIG SET\u003c/code\u003e; a restart (which empties the cache) happens only for startup-only keys. On a cache that is allowed to evict, filling its maxmemory is normal, not a reason to shrink it.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"elasticsearch\" class=\"heading-anchor\"\u003eElasticsearch\u003ca class=\"anchor\" href=\"#elasticsearch\" aria-label=\"Link to section: Elasticsearch\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--elastic [host=] [ram=]\u003c/code\u003e. Defaults to \u003ccode\u003elocalhost\u003c/code\u003e and \u003ccode\u003eauto\u003c/code\u003e heap: index store/4 rounded to 512 MB, between 512 MB and 25% of RAM, 31 GB ceiling.\u003c/p\u003e\n\u003cp\u003eManaged: single-node discovery, X-Pack security off (keep it off unless you have TLS and a firewall), \u003ccode\u003ebootstrap.memory_lock\u003c/code\u003e, thread pools sized from CPUs, a 200 MB content limit, \u003ccode\u003evm.max_map_count\u003c/code\u003e, and — when the index fits in the memory plan — \u003ccode\u003eindex.store.preload: [\u0026quot;*\u0026quot;]\u003c/code\u003e, so index files are loaded at open rather than on first query.\u003c/p\u003e\n\u003cp\u003eIt also fixes the yellow health a single node reports because of unassigned replicas, by setting replicas to 0 plus a low-priority template. A probe endpoint follows \u003ccode\u003ehttp.host\u003c/code\u003e/\u003ccode\u003enetwork.host\u003c/code\u003e/\u003ccode\u003ehttp.port\u003c/code\u003e if you change them.\u003c/p\u003e\n\u003ch2 id=\"others-and-domains\" class=\"heading-anchor\"\u003eOthers and domains\u003ca class=\"anchor\" href=\"#others-and-domains\" aria-label=\"Link to section: Others and domains\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--others\u003c/code\u003e takes one or more of \u003ccode\u003esmartmon\u003c/code\u003e, \u003ccode\u003envme\u003c/code\u003e, \u003ccode\u003egif\u003c/code\u003e, \u003ccode\u003enodejs\u003c/code\u003e, \u003ccode\u003esysstat\u003c/code\u003e, or \u003ccode\u003eall\u003c/code\u003e. Node.js comes from NodeSource with the major pinned by \u003ccode\u003eSETUP_NODE_MAJOR\u003c/code\u003e (default 26); an installed major is never switched silently, because the native-addon ABI changes.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003e--domain\u003c/code\u003e is standalone but needs Angie (and MariaDB when \u003ccode\u003edb=\u003c/code\u003e is given), can be repeated, and supports these vhost templates: \u003ccode\u003ebasic\u003c/code\u003e, \u003ccode\u003exf\u003c/code\u003e, \u003ccode\u003ewordpress\u003c/code\u003e, \u003ccode\u003eflarum\u003c/code\u003e, \u003ccode\u003epingvin\u003c/code\u003e, \u003ccode\u003echevereto\u003c/code\u003e, \u003ccode\u003epolr\u003c/code\u003e, \u003ccode\u003elychee\u003c/code\u003e, \u003ccode\u003eshlink\u003c/code\u003e, \u003ccode\u003esfs\u003c/code\u003e, \u003ccode\u003ephp\u003c/code\u003e, \u003ccode\u003enode\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIt creates the document root (\u003ccode\u003e/var/www/\u0026lt;domain\u0026gt;/public\u003c/code\u003e), a self-signed certificate under \u003ccode\u003e/etc/angie/ssl/\u0026lt;domain\u0026gt;/\u003c/code\u003e, and a vhost tested with \u003ccode\u003eangie -t\u003c/code\u003e. Existing vhosts and databases are preserved, and application code is not installed. A dump import runs only into an empty database, and a dump carrying its own \u003ccode\u003eCREATE DATABASE\u003c/code\u003e/\u003ccode\u003eUSE\u003c/code\u003e for another schema is refused before anything loads.\u003c/p\u003e\n\u003cp\u003eA domain install ends with the same tuning pass \u003ccode\u003e--optimize\u003c/code\u003e performs, because a new vhost changes the plan: the PHP worker cap, OPcache file budget, guest cache, and the managed wp-cron / XenForo job entries.\u003c/p\u003e\n\u003ch2 id=\"the-security-pass\" class=\"heading-anchor\"\u003eThe security pass\u003ca class=\"anchor\" href=\"#the-security-pass\" aria-label=\"Link to section: The security pass\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eEvery \u003ccode\u003e--basic\u003c/code\u003e and \u003ccode\u003e--optimize\u003c/code\u003e run includes hardening aimed at the web root:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eWordPress:\u003c/strong\u003e \u003ccode\u003ewp-config.php\u003c/code\u003e owned \u003ccode\u003eroot:www-data\u003c/code\u003e at mode 640, \u003ccode\u003eDISALLOW_FILE_EDIT\u003c/code\u003e and \u003ccode\u003eDISALLOW_FILE_MODS\u003c/code\u003e, \u003ccode\u003eDISABLE_WP_CRON\u003c/code\u003e with a managed cron entry, \u003ccode\u003eWP_DEBUG_DISPLAY=false\u003c/code\u003e, \u003ccode\u003eFORCE_SSL_ADMIN\u003c/code\u003e, placeholder salts replaced, and a globally privileged \u003ccode\u003eDB_USER\u003c/code\u003e narrowed to its own database.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMalware:\u003c/strong\u003e known webshells quarantined under \u003ccode\u003e/var/lib/setup-quarantine/\u003c/code\u003e; suspicious admins, risky plugins, world-writable files and oversized archives reported.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eAPT:\u003c/strong\u003e every third-party repository pinned to its own \u003ccode\u003esigned-by\u003c/code\u003e keyring, so one vendor\u0026rsquo;s key cannot validate another vendor\u0026rsquo;s package.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eAudit:\u003c/strong\u003e reports SSH password authentication, public 80/443 and a non-loopback Elasticsearch.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eSSH hardening, brute-force protection and origin-only firewalling are left to the operator on purpose. They depend on how a host is reached — bastion, VPN, provider firewall — and a script guessing wrong there locks people out.\u003c/p\u003e\n\u003ch2 id=\"--optimize-and-parity-with-install\" class=\"heading-anchor\"\u003e\u003ccode\u003e--optimize\u003c/code\u003e, and parity with install\u003ca class=\"anchor\" href=\"#--optimize-and-parity-with-install\" aria-label=\"Link to section: --optimize, and parity with install\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--optimize\u003c/code\u003e tunes the OS and every installed service in place on 22.04, 24.04 and 26.04. It \u003cstrong\u003enever installs, starts or purges a managed service\u003c/strong\u003e, and never touches swap, the resolver or the firewall. The only package it may add is \u003ccode\u003eangie-module-brotli\u003c/code\u003e (plus Anubis when asked), and the only one it may remove is certbot, once nothing uses it.\u003c/p\u003e\n\u003cp\u003eAngie is synced from the config repository and tested; the service is reloaded \u003cstrong\u003eonce, and only when the tree digest changed\u003c/strong\u003e. A failed sync or test restores the previous tree and unit drop-in. Every application guest cache reports through the same \u003ccode\u003eX-Cache-Status\u003c/code\u003e header.\u003c/p\u003e\n\u003cp\u003eFor Cloudflare-proxied sites (SSL mode \u003cem\u003eFull\u003c/em\u003e), it can move a vhost off certbot to the host\u0026rsquo;s self-signed default pair. That only happens when every name in the server block is an exact host name resolving solely to Cloudflare; a wildcard or regex name keeps the block where it is. The change is then proven by a probe that must echo fresh digits through Cloudflare before the vhost is accepted — a cached answer, a challenge or a 526 is not proof. Without proof, the vhost is restored byte for byte.\u003c/p\u003e\n\u003cp\u003eThe property that makes this trustworthy is a test, not a promise: \u003cstrong\u003ea fresh install followed by \u003ccode\u003e--optimize\u003c/code\u003e produces the same configuration, byte-for-byte.\u003c/strong\u003e That catches ordering, whitespace, file-mode and include-order differences a human would miss, and it means \u0026ldquo;install, then optimize\u0026rdquo; is a safe way to learn the script.\u003c/p\u003e\n\u003ch2 id=\"--upgrade-php\" class=\"heading-anchor\"\u003e\u003ccode\u003e--upgrade-php\u003c/code\u003e\u003ca class=\"anchor\" href=\"#--upgrade-php\" aria-label=\"Link to section: --upgrade-php\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003e--upgrade-php=X.Y\u003c/code\u003e replaces PHP in place. It is standalone and cannot be combined with install flags, \u003ccode\u003e--optimize\u003c/code\u003e, \u003ccode\u003e--purge\u003c/code\u003e, \u003ccode\u003e--diagnostics\u003c/code\u003e, \u003ccode\u003e--restart-all\u003c/code\u003e or \u003ccode\u003e--domain\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe order is what makes it safe:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003cstrong\u003eSnapshot\u003c/strong\u003e every PHP package, extension, \u003ccode\u003eapt-mark\u003c/code\u003e state, operator \u003ccode\u003e.ini\u003c/code\u003e, extra pool and the old \u003ccode\u003e/etc/php\u003c/code\u003e tree under \u003ccode\u003e/var/lib/setup.sh/\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ePreflight the applications.\u003c/strong\u003e It detects WordPress, XenForo and Chevereto roots (including a Redis object-cache drop-in and a XenForo \u003ccode\u003econfig.php\u003c/code\u003e that selects the core Redis provider) and checks the target repository for every hard requirement. If a site would lose an extension, it stops \u003cstrong\u003ebefore the purge\u003c/strong\u003e, with PHP still serving. \u003ccode\u003eSETUP_PHP_ALLOW_MISSING_EXT=1\u003c/code\u003e accepts the loss explicitly.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ePurge\u003c/strong\u003e, then \u003cstrong\u003einstall\u003c/strong\u003e the target and map every old extension. An extension the new release has not published is reported and retried by the next upgrade; core PHP still installs.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMigrate\u003c/strong\u003e operator ini files and extra pools, validate with \u003ccode\u003ephp-fpm -t\u003c/code\u003e, preserve \u003ccode\u003edate.timezone\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eTune\u003c/strong\u003e with the same tuner as install, then repoint Angie from a TCP \u003ccode\u003e127.0.0.1:9000\u003c/code\u003e upstream to the new Unix socket if needed.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eVerify\u003c/strong\u003e CLI version, units, every pool socket, that OPcache really loads, and that Angie has no leftover TCP handler. A Markdown report with rollback commands lands in \u003ccode\u003e/var/log/setup-php-upgrade-\u0026lt;timestamp\u0026gt;.md\u003c/code\u003e. If the tuned FPM does not start, the old version is rolled back.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eThe resulting files are byte-identical to a fresh \u003ccode\u003e--basic … --php ver=X.Y\u003c/code\u003e install, and a following \u003ccode\u003e--optimize\u003c/code\u003e changes nothing.\u003c/p\u003e\n\u003ch2 id=\"maintenance\" class=\"heading-anchor\"\u003eMaintenance\u003ca class=\"anchor\" href=\"#maintenance\" aria-label=\"Link to section: Maintenance\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eCommand\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eBehavior\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--diagnostics\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eone mode-600 \u003ccode\u003ediagnostics.log\u003c/code\u003e: hardware, network, sysctls, units, per-service config and runtime stats, slow/error logs, ownership, UFW, SSH, cron, package state. Read-only, credentials redacted\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--restart-all [--dry-run]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003erepairs \u003ccode\u003e/var/www\u003c/code\u003e log ownership, stops Angie and active PHP-FPM, restarts Valkey/Redis, Elasticsearch (waits for HTTP) and MariaDB (waits for \u003ccode\u003eSELECT 1\u003c/code\u003e), then starts PHP-FPM and Angie. Only units that were active are touched\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e--purge [TARGET...]\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003estops and disables the selected services and removes managed cron entries\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e\u003ccode\u003e--purge\u003c/code\u003e targets are \u003ccode\u003eall\u003c/code\u003e (default), \u003ccode\u003ebasic\u003c/code\u003e, \u003ccode\u003eangie\u003c/code\u003e, \u003ccode\u003ephp\u003c/code\u003e, \u003ccode\u003emariadb\u003c/code\u003e, \u003ccode\u003evalkey\u003c/code\u003e, \u003ccode\u003eelastic\u003c/code\u003e, \u003ccode\u003eothers\u003c/code\u003e. Nothing is uninstalled or deleted: no package, no data, no log. \u003ccode\u003ebasic\u003c/code\u003e restores the recorded hostname line, timezone, DNS, every sysctl the profile wrote, limits, the pre-install CPU governor, the unattended-upgrades state and UFW state, while leaving SSH rules and \u003ccode\u003e/swapfile\u003c/code\u003e alone.\u003c/p\u003e\n\u003cp\u003eThat is the whole point of the recorded state in \u003ccode\u003e/var/lib/setup.sh\u003c/code\u003e: restore means \u003cem\u003erestore what was there\u003c/em\u003e, not \u003cem\u003eassume the default\u003c/em\u003e.\u003c/p\u003e\n\u003ch2 id=\"tuning-pins-and-environment-overrides\" class=\"heading-anchor\"\u003eTuning pins and environment overrides\u003ca class=\"anchor\" href=\"#tuning-pins-and-environment-overrides\" aria-label=\"Link to section: Tuning pins and environment overrides\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eEvery automatic value has an override, and the overrides are scoped:\u003c/p\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003eExample\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003eScope\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_PHP_WORKERS_PER_CPU=1.5\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003einstall or one run; \u003ccode\u003e--optimize\u003c/code\u003e ignores it\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_MARIADB_IO_CAPACITY=\u0026quot;4000 8000\u0026quot;\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003einstall or one run; \u003ccode\u003e--optimize\u003c/code\u003e ignores it\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_BROTLI_LEVEL=6\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003edynamic Brotli level\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_PRECOMPRESS_ASSETS=1\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003epre-compress XenForo/WordPress assets and refresh from cron\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_PHP_PAGE_GZIP=0\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003estop PHP gzipping WordPress/Chevereto pages into the cache\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_WP_GUEST_CACHE=0\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eleave WordPress vhosts uncached instead of adding the include\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003eSETUP_UFW_SSH_LIMIT=0\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eskip \u003ccode\u003eufw limit\u003c/code\u003e on SSH, for an automation host\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eThe distinction matters: values recorded in \u003ccode\u003e/etc/default/setup-tuning\u003c/code\u003e persist across \u003ccode\u003e--optimize\u003c/code\u003e, while tuning pins made for a single run are cleared so the next run returns to the profile. Hand-editing the generated files does neither — the next \u003ccode\u003e--optimize\u003c/code\u003e will quietly correct you.\u003c/p\u003e\n\u003ch2 id=\"testing\" class=\"heading-anchor\"\u003eTesting\u003ca class=\"anchor\" href=\"#testing\" aria-label=\"Link to section: Testing\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe repository tests the claims, not just the code:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003etests/test-tuning.sh\u003c/code\u003e (no root) covers the tuning helpers, memory plan, config repairs and rollback.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003etests/test-dry-run-matrix.sh\u003c/code\u003e runs every flag, app type, purge mode and representative invalid input through \u003ccode\u003e--dry-run\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eCI runs both plus \u003ccode\u003eshellcheck\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003etests/deploy-audit/\u003c/code\u003e captures a host manifest or the managed config before and after, which is how install/\u003ccode\u003e--optimize\u003c/code\u003e parity is checked.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003etests/stress-site/\u003c/code\u003e deploys a synthetic full stack and drives it with local and remote load harnesses; \u003ccode\u003etests/bench-php-matrix/\u003c/code\u003e holds the XenForo/PHP matrix and its reports.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"files-and-state\" class=\"heading-anchor\"\u003eFiles and state\u003ca class=\"anchor\" href=\"#files-and-state\" aria-label=\"Link to section: Files and state\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003ePath\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003ePurpose\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/run/setup.sh.lock\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003erun lock\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/var/lib/setup.sh/\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eoriginals for \u003ccode\u003e--purge basic\u003c/code\u003e, package-origin markers, PHP upgrade snapshots\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/default/setup-tuning\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ehost facts and feature choices kept across runs\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/angie/\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAngie tree, vhosts, certificates, managed maps\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/php/\u0026lt;ver\u0026gt;/fpm/…\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003ezz-setup-optimize.ini\u003c/code\u003e, \u003ccode\u003ecustom_dan.ini\u003c/code\u003e, \u003ccode\u003epool.d/www.conf\u003c/code\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/mysql/mariadb.conf.d/\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e50-server.cnf\u003c/code\u003e base block, \u003ccode\u003e99-setup-optimize.cnf\u003c/code\u003e profile\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/valkey/valkey.conf\u003c/code\u003e, \u003ccode\u003e/run/valkey/valkey.sock\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ecache config and socket\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/etc/elasticsearch/…\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003emanaged block and JVM heap file\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/var/www/logs/\u0026lt;service\u0026gt;/\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eone rotated log tree for every service\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003ccode\u003e/var/log/setup-optimize-*.md\u003c/code\u003e, \u003ccode\u003ediagnostics.log\u003c/code\u003e, \u003ccode\u003esetup_*.log\u003c/code\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003ereports and run logs\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eCredentials are never stored in the repository. The MariaDB password is written only to \u003ccode\u003e/etc/mysqlbkup.cnf\u003c/code\u003e on the target host.\u003c/p\u003e\n\u003ch2 id=\"adopting-it-on-a-host-you-already-have\" class=\"heading-anchor\"\u003eAdopting it on a host you already have\u003ca class=\"anchor\" href=\"#adopting-it-on-a-host-you-already-have\" aria-label=\"Link to section: Adopting it on a host you already have\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eYou do not need a fresh machine:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003ccode\u003e--diagnostics\u003c/code\u003e and read the drift section.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--optimize --dry-run\u003c/code\u003e and check the plan against what you expect.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--optimize\u003c/code\u003e in a window, then \u003ccode\u003e--diagnostics\u003c/code\u003e again.\u003c/li\u003e\n\u003cli\u003eKeep the run log with the change ticket.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eIf a value is wrong for your workload, override it through the documented variables and keep the override recorded, rather than editing generated files that the next run will rewrite.\u003c/p\u003e\n\u003ch2 id=\"what-it-does-not-do\" class=\"heading-anchor\"\u003eWhat it does not do\u003ca class=\"anchor\" href=\"#what-it-does-not-do\" aria-label=\"Link to section: What it does not do\"\u003e#\u003c/a\u003e\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eIt is \u003cstrong\u003enot\u003c/strong\u003e a configuration-management system: no agent, no inventory, no central state. The unit of truth is the repository plus \u003ccode\u003e/var/lib/setup.sh\u003c/code\u003e on the host.\u003c/li\u003e\n\u003cli\u003eIt does \u003cstrong\u003enot\u003c/strong\u003e alter application schemas: no \u003ccode\u003eALTER TABLE\u003c/code\u003e, no index creation, no data change on a forum or CMS database. The README documents measured fixes that are deliberately left to the operator, such as a covering index for the XenForo Media Gallery count query.\u003c/li\u003e\n\u003cli\u003eIt does \u003cstrong\u003enot\u003c/strong\u003e replace monitoring. A host tuned correctly in March can be wrong in June because someone edited one file; \u003ccode\u003e--diagnostics\u003c/code\u003e finds that when you run it, and a periodic run is what turns it into a policy.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eWithin those limits, the design goal is simple: any run, on any supported host, leaves a state you can describe, repeat and undo.\u003c/p\u003e\n","date_modified":"2026-11-21T15:36:19+08:00","date_published":"2026-11-18T10:15:00+08:00","id":"https://ubuntips.com/posts/one-idempotent-script/","summary":"Angie, PHP-FPM, MariaDB, Valkey and Elasticsearch from a single Bash entry point: every command, option and safety rule in one place.","tags":["Ubuntu","Automation","Bash"],"title":"One idempotent script for the whole Ubuntu web stack","url":"https://ubuntips.com/posts/one-idempotent-script/"}],"language":"en-US","title":"Ubuntu Tips","version":"https://jsonfeed.org/version/1.1"}