docker-compose安装n8n自动化工作流
1.docker-compose.yml
文件配置
services:
n8n:
image: docker.n8n.io/n8nio/n8n
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- GENERIC_TIMEZONE=Asia/Shanghai
- TZ=Asia/Shanghai
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
2.nginx
反向代理n8n
配置
注意反代需要添加socket
的支持
server {
listen 80;
server_name your_domian.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
http2 on;
server_name your_domian.com;
client_max_body_size 20M;
#add_header alt-svc 'h3=":443"; ma=2592000';
# 证书的公私钥
ssl_certificate /etc/nginx/cert/cert.pem;
ssl_certificate_key /etc/nginx/cert/cert.key;
#add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
location / {
proxy_pass http://localhost: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 REMOTE-HOST $remote_addr;
proxy_http_version 1.1; # 必要 否则会出现执行任务没有响应的情况
proxy_set_header Upgrade $http_upgrade;# 必要 否则会出现执行任务没有响应的情况
proxy_set_header Connection "upgrade";# 必要 否则会出现执行任务没有响应的情况
}
}
License:
CC BY 4.0