diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-30 00:52:25 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-30 00:52:25 +0100 |
| commit | 8f8cabeaa533e4f4f8156ff8f4f001f9e4228698 (patch) | |
| tree | 60f3445ab7a303d7be10bcb45d51a27042fc5e99 /web/README.md | |
| parent | add deploy script with live verification; cache file hashes by size and mtime (diff) | |
| download | zagan-bet-8f8cabeaa533e4f4f8156ff8f4f001f9e4228698.tar.gz zagan-bet-8f8cabeaa533e4f4f8156ff8f4f001f9e4228698.zip | |
add nginx + php-fpm deployment example
Diffstat (limited to '')
| -rw-r--r-- | web/README.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/web/README.md b/web/README.md index a82c492..e79abd4 100644 --- a/web/README.md +++ b/web/README.md | |||
| @@ -50,6 +50,40 @@ dependency; the client is rustls-only. | |||
| 50 | Cargo itself cannot produce these names: it always writes | 50 | Cargo itself cannot produce these names: it always writes |
| 51 | `target/<triple>/release/<bin>`. The script renames after each build. | 51 | `target/<triple>/release/<bin>`. The script renames after each build. |
| 52 | 52 | ||
| 53 | ## nginx | ||
| 54 | |||
| 55 | `web/nginx.conf.example` is a working server block for a subdomain with an | ||
| 56 | existing certificate. On Arch-based systems: | ||
| 57 | |||
| 58 | ```sh | ||
| 59 | sudo pacman -S nginx php-fpm | ||
| 60 | sudo install -d -o "$USER" -g http -m 0755 /srv/zagan.bet | ||
| 61 | sudo cp web/nginx.conf.example /etc/nginx/conf.d/zagan.bet.conf | ||
| 62 | # edit server_name, root and the certificate paths, then: | ||
| 63 | sudo nginx -t && sudo systemctl enable --now nginx php-fpm | ||
| 64 | ``` | ||
| 65 | |||
| 66 | The pool socket and user are Arch defaults (`http`, | ||
| 67 | `/run/php-fpm/php-fpm.sock`). Check them and adjust `fastcgi_pass` if your | ||
| 68 | distribution differs: | ||
| 69 | |||
| 70 | ```sh | ||
| 71 | grep -E '^(user|group|listen)' /etc/php/php-fpm.d/www.conf | ||
| 72 | ``` | ||
| 73 | |||
| 74 | `rsync` publishes files as `0755`/`0644`, so the `http` worker and the php-fpm | ||
| 75 | pool can read them without extra group juggling. `index.php` is the only | ||
| 76 | script; any other `.php` request 404s instead of executing. | ||
| 77 | |||
| 78 | PHP's opcache is enabled by default and revalidates timestamps every two | ||
| 79 | seconds, so a deployed `index.php` takes effect without reloading php-fpm. If | ||
| 80 | you ever set `opcache.validate_timestamps=0`, reload php-fpm after a deploy. | ||
| 81 | |||
| 82 | The php-fpm unit on Arch uses `PrivateTmp=`, so the hash cache in `/tmp` lives | ||
| 83 | in the service's private tmp. It still works; point `ZAGAN_HASH_CACHE` at a | ||
| 84 | writable path such as `/var/cache/zagan-bet-hashes.json` if you want it to | ||
| 85 | survive a service restart. | ||
| 86 | |||
| 53 | ## Preview locally | 87 | ## Preview locally |
| 54 | 88 | ||
| 55 | ```sh | 89 | ```sh |
