summaryrefslogtreecommitdiffstats
path: root/web/README.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 22:34:19 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 22:34:19 +0100
commitcd3f93bcc2d8e4a5934a19b13f7fdf30ee4e130c (patch)
treec40914124410c0e5a407a14ba284774dbfbff03f /web/README.md
parentv4.4.0: stable installers that follow the newest published build (diff)
downloadzagan-bet-cd3f93bcc2d8e4a5934a19b13f7fdf30ee4e130c.tar.gz
zagan-bet-cd3f93bcc2d8e4a5934a19b13f7fdf30ee4e130c.zip
web: serve latest.php through PHP and refuse stray PHP files
nginx example now routes index.php and latest.php to php-fpm, sends the newest-version feed with no-store, keeps the stable installers revalidated, and returns 404 for every other .php request so releases.php cannot be downloaded as source. Documents Debian and Arch pool sockets.
Diffstat (limited to '')
-rw-r--r--web/README.md38
1 files changed, 25 insertions, 13 deletions
diff --git a/web/README.md b/web/README.md
index 13f5f85..81346fd 100644
--- a/web/README.md
+++ b/web/README.md
@@ -71,34 +71,46 @@ Cargo itself cannot produce these names: it always writes
71## nginx 71## nginx
72 72
73`web/nginx.conf.example` is a working server block for a subdomain with an 73`web/nginx.conf.example` is a working server block for a subdomain with an
74existing certificate. On Arch-based systems: 74existing certificate. Debian/Ubuntu and Arch install it the same way:
75 75
76```sh 76```sh
77# Debian / Ubuntu
78sudo apt install nginx php-fpm
79sudo install -d -o "$USER" -g www-data -m 0755 /srv/zagan.bet
80
81# Arch
77sudo pacman -S nginx php-fpm 82sudo pacman -S nginx php-fpm
78sudo install -d -o "$USER" -g http -m 0755 /srv/zagan.bet 83sudo install -d -o "$USER" -g http -m 0755 /srv/zagan.bet
84
79sudo cp web/nginx.conf.example /etc/nginx/conf.d/zagan.bet.conf 85sudo cp web/nginx.conf.example /etc/nginx/conf.d/zagan.bet.conf
80# edit server_name, root and the certificate paths, then: 86# edit server_name, root, socket and certificate paths, then:
81sudo nginx -t && sudo systemctl enable --now nginx php-fpm 87sudo nginx -t && sudo systemctl enable --now nginx php-fpm
82``` 88```
83 89
84The pool socket and user are Arch defaults (`http`, 90The example uses Debian/Ubuntu's pool socket (`/run/php/php-fpm.sock`); Arch
85`/run/php-fpm/php-fpm.sock`). Check them and adjust `fastcgi_pass` if your 91uses `/run/php-fpm/php-fpm.sock`. Check the pool's user and socket and adjust
86distribution differs: 92`fastcgi_pass` if your distribution differs:
87 93
88```sh 94```sh
89grep -E '^(user|group|listen)' /etc/php/php-fpm.d/www.conf 95grep -E '^(user|group|listen)' /etc/php/*/fpm/pool.d/www.conf /etc/php-fpm.d/www.conf 2>/dev/null
90``` 96```
91 97
92`rsync` publishes files as `0755`/`0644`, so the `http` worker and the php-fpm 98`rsync` publishes files as `0755`/`0644`, so the PHP worker can read them
93pool can read them without extra group juggling. `index.php` is the only 99without extra group juggling. `index.php` and `latest.php` are the only
94script; any other `.php` request 404s instead of executing. 100scripts; `releases.php` is an include, and the example returns 404 for every
101other `.php` request instead of serving it as source.
102
103The example sends `/latest.php` with `no-store` and the two installers with
104`no-cache`, so a new release is picked up immediately without giving up the
105immutable caching on `/bin/`.
95 106
96PHP's opcache is enabled by default and revalidates timestamps every two 107PHP's opcache is enabled by default and revalidates timestamps every two
97seconds, so a deployed `index.php` takes effect without reloading php-fpm. If 108seconds, so a deployed `index.php` or `latest.php` takes effect without
98you ever set `opcache.validate_timestamps=0`, reload php-fpm after a deploy. 109reloading php-fpm. If you ever set `opcache.validate_timestamps=0`, reload
110php-fpm after a deploy.
99 111
100The php-fpm unit on Arch uses `PrivateTmp=`, so the hash cache in `/tmp` lives 112The php-fpm unit often uses `PrivateTmp=`, so the hash cache in `/tmp` lives in
101in the service's private tmp. It still works; point `ZAGAN_HASH_CACHE` at a 113the service's private tmp. It still works; point `ZAGAN_HASH_CACHE` at a
102writable path such as `/var/cache/zagan-bet-hashes.json` if you want it to 114writable path such as `/var/cache/zagan-bet-hashes.json` if you want it to
103survive a service restart. 115survive a service restart.
104 116