On 2026-10-19 nginx's only worker stalled for 4.6 hours. The master kept the container "Up" and the tunnel stayed connected, so nothing noticed, while every request timed out in the TLS handshake. - worker_processes auto in the production and dev configs, so one stuck worker no longer takes the whole site down. - A /nginx-health endpoint on :80 in all three configs, answered by nginx and unlogged, and a compose healthcheck on it. - autoheal is back (retired 2026-10-01), pinned by digest, with no network, restarting only containers labelled autoheal=true: just nginx. - Gitea's commit-pinned views, archives and compare pages go through the site admin gate. A swarm of 103k IPs made 129k requests to them in two days, 89% in those shapes; the branch views stay public for the CV links. Co-Authored-By: Claude Opus 5.5 <[email protected]>
119 lines
4.1 KiB
Plaintext
119 lines
4.1 KiB
Plaintext
# =============================================================================
|
|
# nginx_dev.conf.template — LOCAL DEVELOPMENT config.
|
|
#
|
|
# WHEN IT IS USED
|
|
# Rendered by nginx/entrypoint.sh whenever DEV_MODE=true, which is set only
|
|
# by docker-compose.dev.yml. Never used on the Pi.
|
|
#
|
|
# HOW IT DIFFERS FROM nginx.conf.template
|
|
# - `/` is proxied to the Vite dev server at vue:5173 instead of serving
|
|
# built files from disk. The Upgrade/Connection headers on that block are
|
|
# for Vite's HMR websocket, not for the app.
|
|
# - No HTTP->HTTPS redirect and no apex->www redirect: BOTH :80 and :443
|
|
# serve the full site, so http://localhost just works. The two server
|
|
# blocks therefore share one body, nginx_dev_common.conf.template.
|
|
# - TLS uses the self-signed /etc/letsencrypt/live/localhost/ certificate that
|
|
# the entrypoint generates, not a Let's Encrypt one. Browsers will warn.
|
|
# - No HSTS or other security headers — HSTS on localhost would poison the
|
|
# browser for every other localhost project on the machine.
|
|
# - No `graphql` rate-limit zone (the production template has one); GraphQL
|
|
# falls under the general `api` limit here.
|
|
# - No /assets/, /fonts/, /img/ cache-control blocks: Vite serves those and
|
|
# long cache lifetimes would defeat hot reload.
|
|
#
|
|
# TEMPLATING
|
|
# Same envsubst allow-list as production. Every other dollar token is an
|
|
# nginx runtime variable and must survive substitution untouched.
|
|
#
|
|
# INCLUDE CHAIN
|
|
# this file -> nginx_dev_common.conf (once per server block: the dev-only
|
|
# /uploads/ and `/` locations) -> nginx_routes.conf (the proxy route table
|
|
# shared with production). The prefix-strip rewrite, the four forwarding
|
|
# headers, the websocket upgrade block and the auth_request admin gate are
|
|
# annotated in nginx_routes.conf.template; the rate-limit reasoning is in
|
|
# nginx.conf.template.
|
|
# =============================================================================
|
|
|
|
# As in production; why is in nginx.conf.template.
|
|
worker_processes auto;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
server_tokens off;
|
|
charset utf-8;
|
|
|
|
resolver 127.0.0.11 valid=10s;
|
|
|
|
client_max_body_size 50M;
|
|
|
|
# These four zones are referenced by limit_req lines in the SHARED
|
|
# nginx_routes.conf.template, so they must exist here with the same names
|
|
# as in nginx.conf.template or nginx refuses to load the config. Rates are
|
|
# kept equal to production so a limit that would bite there bites here too.
|
|
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
|
|
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
|
limit_req_zone $binary_remote_addr zone=upload:10m rate=30r/m;
|
|
limit_req_zone $binary_remote_addr zone=hotel_search:10m rate=3r/m;
|
|
|
|
log_format compact
|
|
'$remote_addr "$request" $status rt=$request_time';
|
|
|
|
access_log /var/log/nginx/access.log compact;
|
|
|
|
# JSON request-body log for Dozzle; see payload_log.conf.
|
|
include /etc/nginx/payload_log.conf;
|
|
|
|
types {
|
|
text/javascript mjs;
|
|
}
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_min_length 256;
|
|
gzip_types
|
|
text/plain
|
|
text/css
|
|
text/javascript
|
|
application/javascript
|
|
application/json
|
|
application/xml
|
|
image/svg+xml
|
|
font/woff2
|
|
application/font-woff2;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name $DOMAIN www.$DOMAIN;
|
|
|
|
# The container healthcheck's target; see nginx.conf.template. Only in
|
|
# this block, as in production, where it sits in the :80 server too.
|
|
location = /nginx-health {
|
|
access_log off;
|
|
return 204;
|
|
}
|
|
|
|
include /etc/nginx/nginx_dev_common.conf;
|
|
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name $DOMAIN www.$DOMAIN;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/localhost/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/localhost/privkey.pem;
|
|
|
|
include /etc/nginx/nginx_dev_common.conf;
|
|
|
|
}
|
|
|
|
}
|