asdf
This commit is contained in:
1 parent
cc41849cf5
commit
f84687d745
22 files changed
+555
-14
No files matched your search
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Runs the contact handler next to nginx. The handler is restarted if it crashes, but not when it
|
||||
# exits for missing configuration (code 78); the static site is served either way.
|
||||
(
|
||||
cd /srv/contact || exit
|
||||
while :; do
|
||||
node contact.mjs
|
||||
code=$?
|
||||
[ "$code" -eq 78 ] && { echo "contact: not started, SMTP is not configured." >&2; exit; }
|
||||
echo "contact: exited with $code, restarting in 5 s." >&2
|
||||
sleep 5
|
||||
done
|
||||
) &
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
@@ -7,6 +7,13 @@ server {
|
||||
|
||||
# TLS terminates at Dokploy's Traefik; keep redirects relative so they stay on https.
|
||||
absolute_redirect off;
|
||||
|
||||
# The client address arrives in X-Forwarded-For from Traefik on the private network.
|
||||
set_real_ip_from 10.0.0.0/8;
|
||||
set_real_ip_from 172.16.0.0/12;
|
||||
set_real_ip_from 192.168.0.0/16;
|
||||
real_ip_header X-Forwarded-For;
|
||||
real_ip_recursive on;
|
||||
server_tokens off;
|
||||
|
||||
gzip on;
|
||||
@@ -24,6 +31,24 @@ server {
|
||||
return 200 "ok\n";
|
||||
}
|
||||
|
||||
# The contact form is the one dynamic path: server/contact.mjs, sending by SMTP.
|
||||
location = /contact {
|
||||
limit_except POST { deny all; }
|
||||
client_max_body_size 64k;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 30s;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 503 504 = @contact_down;
|
||||
}
|
||||
# Handler not running: send the visitor to the error page in their language.
|
||||
location @contact_down {
|
||||
if ($http_referer ~ "/de(/|$|#)") { return 303 /de/contact/error; }
|
||||
return 303 /contact/error;
|
||||
}
|
||||
|
||||
# trailingSlash: 'never' — /team is served from /team/index.html; /team/ redirects to /team.
|
||||
location ~ ^(.+)/$ {
|
||||
return 301 $1$is_args$args;
|
||||
|
||||
Reference in new issue
Block a user