Move the retired nginx and certbot into .deprecated
Nothing references nginx/ or certbot/ since the cutover to Caddy (daa2a46),
so they join quartz, hasura and autoheal in .deprecated/, with a README
entry on how to bring them back. The rollback steps in DEPLOYMENT.md §7 now
revert this commit and then the cutover. The host keeps ./certbot/conf (the
last certbot certificate, valid until 2027-01-20) and ./logs/nginx until the
rollback is no longer wanted; .gitignore still covers certbot/conf and
certbot/www for that reason.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
# =============================================================================
|
||||
# nginx_dev_common.conf.template — SHARED BODY of the dev :80 and :443 server
|
||||
# blocks.
|
||||
#
|
||||
# WHY THIS FILE EXISTS
|
||||
# In dev the :80 and :443 server blocks are byte-for-byte identical apart
|
||||
# from `listen` and the self-signed `ssl_certificate` pair. They used to be
|
||||
# ~190 duplicated lines, so every routing fix had to be made twice and could
|
||||
# silently drift. Both blocks now `include` this partial instead.
|
||||
#
|
||||
# HOW IT IS RENDERED
|
||||
# nginx/entrypoint.sh runs the SAME envsubst allow-list over this file as
|
||||
# over nginx_dev.conf.template, writing the result to
|
||||
# /etc/nginx/nginx_dev_common.conf — which is exactly the path the two
|
||||
# `include` directives in the rendered nginx.conf point at. If you add
|
||||
# a new substituted variable here, it must also be added to ENVSUBST_VARS in
|
||||
# the entrypoint, or it will reach nginx unsubstituted.
|
||||
#
|
||||
# WHAT BELONGS HERE
|
||||
# Only what dev does DIFFERENTLY from production inside a server block: the
|
||||
# /uploads/ locations without security headers, and `/` proxied to Vite.
|
||||
# Everything else — the `set $upstream_*` vars and every reverse-proxied
|
||||
# route — is in nginx_routes.conf.template, shared with production and
|
||||
# included at the bottom of this file. ADD NEW PROXIED ROUTES THERE, not
|
||||
# here.
|
||||
# NOT `listen`, `server_name` or the ssl_certificate lines (those differ
|
||||
# between the two blocks), and NOT the enclosing braces — this file must be
|
||||
# brace-balanced on its own.
|
||||
#
|
||||
# This is the DEV file only. Production's single :443 www server block in
|
||||
# nginx.conf.template includes nginx_routes.conf directly.
|
||||
# =============================================================================
|
||||
# PRIVATE attachments (admin-only). Attachments on *private* chat
|
||||
# messages are written by the backend to /backend/uploads/private/ and
|
||||
# must not be readable by the public, so this subpath is put behind the
|
||||
# same admin `auth_request` used for /sb/. nginx picks
|
||||
# the LONGEST matching prefix location, so this block wins over the
|
||||
# public /uploads/ block below for /uploads/private/* regardless of
|
||||
# ordering. Same three hardening headers as the public block, because
|
||||
# the bytes are just as attacker-supplied.
|
||||
location /uploads/private/ {
|
||||
auth_request /internal/auth/admin-validate;
|
||||
error_page 401 403 = @auth_denied;
|
||||
alias /uploads/private/;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Content-Disposition "inline" always;
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
}
|
||||
|
||||
# The /uploads/ blocks (and @uploads_disk) are the production ones MINUS
|
||||
# `include security_headers.conf`: that file carries HSTS, which must
|
||||
# never be sent from localhost. That one line is why they are not in
|
||||
# the shared route table (see WHAT DOES NOT in
|
||||
# nginx_routes.conf.template). Keep the rest in step with
|
||||
# nginx.conf.template.
|
||||
location /uploads/ {
|
||||
rewrite ^/uploads/(.*)$ /$1 break;
|
||||
proxy_pass $upstream_garage_web;
|
||||
proxy_set_header Host uploads.web.garage;
|
||||
proxy_connect_timeout 2s;
|
||||
proxy_intercept_errors on;
|
||||
error_page 404 500 502 503 504 = @uploads_disk;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Content-Disposition "inline" always;
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
}
|
||||
|
||||
location @uploads_disk {
|
||||
root /uploads;
|
||||
try_files $uri =404;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Content-Disposition "inline" always;
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
}
|
||||
|
||||
# The Vite dev server; Upgrade/Connection carry its HMR websocket.
|
||||
location / {
|
||||
proxy_pass http://vue:5173;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# Every other route, shared with production. This file has no regex
|
||||
# locations of its own, so where the include sits is cosmetic.
|
||||
include /etc/nginx/nginx_routes.conf;
|
||||
Reference in New Issue
Block a user