I am currently deploying a self-hosted n8n instance for my company’s Intranet. The requirements are simple: Internal access only and No Reverse Proxy (Nginx). We plan to connect directly via the internal domain/IP.
Since there is no proxy handling port 80/443, I have configured the WEBHOOK_URL to explicitly point to port 5678.
version: ‘3.8’
volumes:
db_storage:
n8n_storage:
services:
postgres:
image: postgres:16
container_name: n8n_postgres
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes: - db_storage:/var/lib/postgresql/data
healthcheck:
test: [‘CMD-SHELL’, ‘pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}’]
interval: 5s
timeout: 5s
retries: 5
n8n:
image: docker.n8n.io/n8nio/n8n
container_name: n8n_app
restart: always
depends_on:
postgres:
condition: service_healthy
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- N8N_HOST=${DOMAIN_NAME}
- N8N_PROTOCOL=http
- WEBHOOK_URL=http://${DOMAIN_NAME}:5678/
- N8N_EDITOR_BASE_URL=http://${DOMAIN_NAME}:5678/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- TZ=${TZ}
ports: - “5678:5678”
volumes: - n8n_storage:/home/node/.n8n
command: /bin/sh -c “n8n start”