# ============================================================================= # 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 are therefore near-identical copies of each other (see the # duplication note in DEPLOYMENT.md). # - 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. # # For the rate-limit reasoning, the prefix-strip rewrite, the four forwarding # headers, the websocket upgrade block and the auth_request admin gate, see the # fully-annotated equivalents in nginx.conf.template — the mechanics here are # identical. # ============================================================================= 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; 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=5r/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; 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; 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; } }