n8n is an open-source, node-based workflow automation engine (a self-hosted alternative to Zapier and Make) with hundreds of integrations and full control over data flow. This guide deploys n8n using Docker Compose with Traefik handling automatic HTTPS. By the end, you'll have an n8n instance running securely at your domain, ready to build workflows.
Set Up the Directory Structure
1. Create the project directory structure:
$ mkdir -p ~/n8n-automation/n8n-data
$ cd ~/n8n-automation
2. Set ownership for the n8n data directory:
$ sudo chown -R 1000:1000 n8n-data
3. Create the environment file:
$ nano .env
DOMAIN=n8n.example.com
LETSENCRYPT_EMAIL=admin@example.com
Deploy with Docker Compose
1. Create the Docker Compose manifest:
$ nano docker-compose.yaml
services:
traefik:
image: traefik:v3.6
container_name: traefik
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
n8n:
image: n8nio/n8n:latest
container_name: n8n
hostname: n8n
expose:
- "5678"
volumes:
- "./n8n-data:/home/node/.n8n"
environment:
- N8N_HOST=${DOMAIN}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://${DOMAIN}/
- GENERIC_TIMEZONE=UTC
labels:
- "traefik.enable=true"
- "traefik.http.routers.n8n.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.n8n.entrypoints=websecure"
- "traefik.http.routers.n8n.tls.certresolver=letsencrypt"
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
restart: unless-stopped
volumes:
letsencrypt:
2. Start the services:
$ docker compose up -d
3. Verify the services are running:
$ docker compose ps
4. View the logs:
$ docker compose logs
Access n8n
Open https://n8n.example.com in a browser. The first sign-up creates the owner account — from there you can build workflows in the node-based editor or import community templates.
Next Steps
n8n is running and served securely over HTTPS. From here you can:
- Connect to your services with built-in nodes (HTTP, databases, SaaS APIs, AI)
- Add credentials and create scheduled, webhook-triggered, or event-driven workflows
- Switch persistence to PostgreSQL for production-scale workloads
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)