# Nginx Reverse Proxy Konfiguration für n8n mit LibreBooking # Beispielkonfiguration für HTTPS Zugang # # Verwendung: # 1. Diese Datei nach /etc/nginx/sites-available/n8n kopieren # 2. ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/ # 3. SSL-Zertifikate einrichten (z.B. mit Certbot) # 4. nginx -t && systemctl reload nginx # Upstream für n8n upstream n8n_backend { server 127.0.0.1:5678; keepalive 32; } # HTTP -> HTTPS Redirect server { listen 80; listen [::]:80; server_name n8n.example.com; # ACME Challenge für Let's Encrypt location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } # HTTPS Server server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name n8n.example.com; # SSL-Zertifikate (Let's Encrypt Beispiel) ssl_certificate /etc/letsencrypt/live/n8n.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/n8n.example.com/privkey.pem; # SSL-Einstellungen (moderne Konfiguration) ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers off; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; # HSTS add_header Strict-Transport-Security "max-age=63072000" always; # Logging access_log /var/log/nginx/n8n_access.log; error_log /var/log/nginx/n8n_error.log; # Proxy-Einstellungen location / { proxy_pass http://n8n_backend; proxy_http_version 1.1; # WebSocket Support (wichtig für n8n Editor) proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Standard Proxy Headers 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; proxy_set_header X-Forwarded-Port $server_port; # Timeouts (erhöht für lange Workflow-Ausführungen) proxy_connect_timeout 60s; proxy_send_timeout 300s; proxy_read_timeout 300s; # Buffer-Einstellungen proxy_buffering off; proxy_buffer_size 4k; # Client-Upload Limit (anpassen nach Bedarf) client_max_body_size 50M; } # Webhook-spezifische Einstellungen location /webhook/ { proxy_pass http://n8n_backend; 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; # Erhöhte Timeouts für Webhooks proxy_connect_timeout 60s; proxy_send_timeout 600s; proxy_read_timeout 600s; proxy_buffering off; client_max_body_size 100M; } # Health Check Endpoint location /healthz { proxy_pass http://n8n_backend/healthz; proxy_http_version 1.1; proxy_set_header Host $host; access_log off; } } # Optional: Monitoring/Metrics Server Block # server { # listen 127.0.0.1:9090; # server_name localhost; # # location /nginx_status { # stub_status on; # allow 127.0.0.1; # deny all; # } # }