summaryrefslogtreecommitdiffstats
path: root/web/nginx.conf.example
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-30 00:52:25 +0100
committersalmonik <salmonik@tuta.io>2026-10-30 00:52:25 +0100
commit8f8cabeaa533e4f4f8156ff8f4f001f9e4228698 (patch)
tree60f3445ab7a303d7be10bcb45d51a27042fc5e99 /web/nginx.conf.example
parentadd deploy script with live verification; cache file hashes by size and mtime (diff)
downloadzagan-bet-8f8cabeaa533e4f4f8156ff8f4f001f9e4228698.tar.gz
zagan-bet-8f8cabeaa533e4f4f8156ff8f4f001f9e4228698.zip
add nginx + php-fpm deployment example
Diffstat (limited to '')
-rw-r--r--web/nginx.conf.example55
1 files changed, 55 insertions, 0 deletions
diff --git a/web/nginx.conf.example b/web/nginx.conf.example
new file mode 100644
index 0000000..ad001d1
--- /dev/null
+++ b/web/nginx.conf.example
@@ -0,0 +1,55 @@
1# zagan.bet download page — nginx + php-fpm example.
2#
3# Install at /etc/nginx/conf.d/zagan.bet.conf (the packaged nginx.conf includes
4# conf.d/*.conf). Replace the server name, root and certificate paths.
5#
6# Only index.php is PHP; everything under /bin/ is served as static files.
7# The binaries are versioned, so they can be cached forever — which means you
8# must bump the version (Cargo.toml) instead of overwriting a published file.
9
10server {
11 listen 80;
12 listen [::]:80;
13 server_name dl.example.com;
14 return 301 https://$host$request_uri;
15}
16
17server {
18 listen 443 ssl;
19 listen [::]:443 ssl;
20 http2 on;
21 server_name dl.example.com;
22
23 root /srv/zagan.bet;
24 index index.php;
25
26 ssl_certificate /etc/letsencrypt/live/dl.example.com/fullchain.pem;
27 ssl_certificate_key /etc/letsencrypt/live/dl.example.com/privkey.pem;
28 ssl_protocols TLSv1.2 TLSv1.3;
29 ssl_prefer_server_ciphers off;
30 ssl_session_cache shared:SSL:10m;
31 ssl_session_timeout 1d;
32
33 # Published binaries: static, versioned, never rewritten.
34 location /bin/ {
35 try_files $uri =404;
36 add_header Cache-Control "public, max-age=31536000, immutable";
37 }
38
39 # The page rescans bin/ on every request, so don't cache it.
40 location = /index.php {
41 include fastcgi_params;
42 fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
43 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
44 add_header Cache-Control "no-cache";
45 }
46
47 location / {
48 try_files $uri $uri/ =404;
49 }
50
51 # Never serve dotfiles (.gitignore, editor leftovers).
52 location ~ /\. {
53 deny all;
54 }
55}