在 HestiaCP 管理伺服器,
將 透過 Docker 部屬的 n8n 工作流程自動化平台,配置到 Nginx Proxy Template 上

依照 HestiaCP 官方提供的 Web Template 配置說明
進入 Nginx (代理 Proxy) 的 配置目錄
/usr/local/hestia/data/templates/web/nginx/
建立樣板
vim n8n.stpl
server {
listen %ip%:%proxy_port%;
server_name %domain_idn% %alias_idn%;
error_log /var/log/%web_system%/domains/%domain%.error.log error;
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
location ~ /\.(?!well-known\/|file) {
deny all;
return 404;
}
location / {
proxy_pass http://%ip%:5678;
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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
location ~* ^.+\.(%proxy_extensions%)$ {
try_files $uri @fallback;
root %docroot%;
access_log /var/log/%web_system%/domains/%domain%.log combined;
access_log /var/log/%web_system%/domains/%domain%.bytes bytes;
expires max;
}
}
location @fallback {
proxy_pass http://%ip%:5678;
}
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}
重建 user 樣板 並重啟 nginx
v-rebuild-web-domains {user}
sudo systemctl restart nginx
docker compose 配置 n8n
N8N_PROXY_HOPS=1
