93 lines
3.3 KiB
Plaintext
93 lines
3.3 KiB
Plaintext
# nginx/wegwichtel.conf
|
|
#
|
|
# Reverse-Proxy-Konfiguration für Wegwichtel.
|
|
#
|
|
# Voraussetzung:
|
|
# - Wegwichtel lauscht lokal auf 127.0.0.1:47145
|
|
#
|
|
# Aktiv verwendet die Konfiguration ausschließlich HTTP auf Port 80.
|
|
# Die auskommentierten SSL-Direktiven dienen nur als Vorlage. Die dort
|
|
# referenzierten Dateien snakeoil.pem und snakeoil.key existieren bewusst nicht.
|
|
# TLS kann später beispielsweise durch Certbot ergänzt werden.
|
|
#
|
|
# Installation z. B.:
|
|
# sudo cp nginx/wegwichtel.conf /etc/nginx/sites-available/wegwichtel.conf
|
|
# sudo ln -s /etc/nginx/sites-available/wegwichtel.conf /etc/nginx/sites-enabled/wegwichtel.conf
|
|
# sudo nginx -t
|
|
# sudo systemctl reload nginx
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
# listen 443 ssl;
|
|
# listen [::]:443 ssl;
|
|
|
|
server_name wegwichtel.de www.wegwichtel.de;
|
|
|
|
# SSL-Vorlage. Die Zertifikatsdateien sind absichtlich nicht vorhanden.
|
|
# Vor einer manuellen Aktivierung müssen sie durch reale Zertifikatspfade
|
|
# ersetzt oder die Konfiguration durch ein Werkzeug wie Certbot angepasst werden.
|
|
# ssl_certificate /etc/nginx/ssl/snakeoil.pem;
|
|
# ssl_certificate_key /etc/nginx/ssl/snakeoil.key;
|
|
# ssl_protocols TLSv1.2 TLSv1.3;
|
|
# ssl_session_cache shared:SSL:10m;
|
|
# ssl_session_timeout 1d;
|
|
# ssl_session_tickets off;
|
|
|
|
# Lokale Strecken bleiben im Browser. Medien-Uploads sind nur für
|
|
# noch nicht freigegebene Server-Strecken vorgesehen.
|
|
client_max_body_size 64m;
|
|
|
|
# Sicherheitsheader, die mit dem bestehenden Frontend kompatibel bleiben.
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# Passwortdatei außerhalb des Projekt-/Webverzeichnisses ablegen.
|
|
location ^~ /moderation/api/ {
|
|
if ($scheme != https) { return 403; }
|
|
auth_basic "Wegwichtel Moderation";
|
|
auth_basic_user_file /etc/nginx/wegwichtel-moderation.htpasswd;
|
|
limit_except GET { deny all; }
|
|
|
|
proxy_pass http://127.0.0.1:47145/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Authorization "";
|
|
proxy_cache off;
|
|
proxy_hide_header Cache-Control;
|
|
add_header Cache-Control "no-store" always;
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:47145;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
# Verhindert unnötiges Puffern größerer Medien-Uploads.
|
|
proxy_request_buffering off;
|
|
|
|
proxy_connect_timeout 10s;
|
|
proxy_send_timeout 120s;
|
|
proxy_read_timeout 120s;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
proxy_pass http://127.0.0.1:47145/favicon.ico;
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
access_log /var/log/nginx/wegwichtel.access.log;
|
|
error_log /var/log/nginx/wegwichtel.error.log warn;
|
|
}
|