Hello everyone! I’m fairly new to n8n and I’m currently attempting to deploy it to my server using Docker Compose, along with an Apache server as a reverse proxy that runs outside of Docker and Cloudflare. I’ve been searching for a similar installation guide on this forum, but haven’t found one yet. So, I’ve made some modifications to the docker-compose.yml file, but I’m not entirely sure if it will work correctly in this configuration. If anyone can tell me if this works or offer any advice I would be very grateful!
docker-compose.yml
version: "3"
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_HOST=n8n.domain.com
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.domain.com/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
volumes:
- .n8n:/home/node/.n8n
n8n.domain.com.conf (apache config)
<VirtualHost *:443>
ServerName n8n.domain.com
RemoteIPHeader CF-Connecting-IP
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/n8n.domain.com/n8n.domain.com.pem
SSLCertificateKeyFile /etc/apache2/ssl/n8n.domain.com/n8n.domain.com.key
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>