server { listen 80; server_name your.domain.com; # Replace with your actual domain return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name your.domain.com; # Replace with your actual domain ssl_certificate /path/to/your/fullchain.pem; # Replace with your certificate path (e.g., /etc/letsencrypt/live/your.domain.com/fullchain.pem) ssl_certificate_key /path/to/your/privkey.pem; # Replace with your private key path (e.g., /etc/letsencrypt/live/your.domain.com/privkey.pem) ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers "ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20"; ssl_prefer_server_ciphers on; # Optional: Enable HSTS # add_header Strict-Transport-Security "max-age=63072000" always; location / { proxy_pass http://localhost:5678; # n8n is running on port 5678 on the host 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 Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Required for n8n Webhook URLs proxy_set_header X-N8N-Webhook-Url $scheme://$host$request_uri; } }