n8n is an open-source workflow automation tool: connect APIs, databases, webhooks and AI into automations, with a visual editor. Self-hosted, there’s no per-task bill — you run as much as your VPS can handle.
Prerequisites
- A VPS with 1–2 GB RAM (options).
- A domain like
n8n.yourdomain.com(point it at the VPS). - Docker + Docker Compose, plus a reverse proxy for HTTPS.
Step 1 — Compose file
services:
n8n:
image: n8nio/n8n:latest
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.yourdomain.com/
- GENERIC_TIMEZONE=Asia/Shanghai
- N8N_SECURE_COOKIE=true
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Step 2 — Start it
docker compose up -d
Step 3 — HTTPS
Webhooks need a real HTTPS URL, so put Nginx Proxy Manager in front and map n8n.yourdomain.com to the container on port 5678, with a Let’s Encrypt cert: Nginx Proxy Manager setup.
Step 4 — First login & workflows
Open https://n8n.yourdomain.com, create the owner account, and build your first workflow. For production use, set up Postgres and regular backups of the n8n_data volume.
Which VPS to run it on
n8n is light to start. A 1–2 GB Hetzner or Vultr box is plenty; Cloudways if you want it managed. See Best VPS for Self-Hosting.