Self-Host n8n on a VPS for Under $10/Month
· By AI Compare
A production-ready n8n setup with HTTPS and Postgres for the price of a small server.
What you get
A production-ready n8n instance with HTTPS, a real database and automatic restarts, on a small virtual private server (VPS). Software cost: $0. Server cost: typically $5–10 per month.
Cost breakdown
| Item | Typical monthly cost | Notes |
|---|---|---|
| VPS (1–2 vCPU, 2–4 GB RAM) | $5–10 | 1 GB works for light use; 2 GB+ is more comfortable |
| Domain name | ~$1 (about $10–15/year) | Optional, but needed for clean HTTPS webhooks |
| Backups / snapshots | $1–2 | Most providers charge ~20% of the server price |
| n8n Community Edition | $0 | Unlimited workflows and executions |
| Total | About $7–13 |
VPS prices move a lot in 2026. DigitalOcean's 1 GB droplet is $6/month; Hetzner's cheapest cost-optimised plans have been intermittently unavailable this year. Compare current prices before you choose a provider.
Compare that with n8n Cloud Starter at €20/month for 2,500 executions. If you run more than a few thousand executions a month, self-hosting pays for itself immediately.
What you need
- A VPS running Ubuntu 22.04 or 24.04.
- A domain or subdomain, for example
n8n.yourcompany.com, pointed at the server's IP with an A record. - Basic comfort with SSH and the command line.
Step 1: Secure the server
ssh root@YOUR_SERVER_IP
apt update && apt upgrade -y
adduser n8nadmin && usermod -aG sudo n8nadmin
ufw allow OpenSSH && ufw allow 80 && ufw allow 443 && ufw enable
Use SSH keys and disable password login once you have confirmed key access works.
Step 2: Install Docker
curl -fsSL https://get.docker.com | sh
usermod -aG docker n8nadmin
Log out and back in as n8nadmin.
Step 3: Create the Docker Compose file
Create a folder and a docker-compose.yml:
services:
caddy:
image: caddy:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
postgres:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_USER: n8n
POSTGRES_PASSWORD: change-this-password
POSTGRES_DB: n8n
volumes:
- db_data:/var/lib/postgresql/data
n8n:
image: docker.n8n.io/n8nio/n8n
restart: unless-stopped
environment:
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: change-this-password
N8N_HOST: n8n.yourcompany.com
N8N_PROTOCOL: https
WEBHOOK_URL: https://n8n.yourcompany.com/
GENERIC_TIMEZONE: Europe/Budapest
N8N_ENCRYPTION_KEY: generate-a-long-random-string
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- postgres
volumes:
caddy_data:
db_data:
n8n_data:
And a Caddyfile next to it:
n8n.yourcompany.com {
reverse_proxy n8n:5678
}
Caddy gets and renews a free HTTPS certificate automatically.
Step 4: Start it
docker compose up -d
Open https://n8n.yourcompany.com and create the owner account.
Step 5: Back up properly
- Save
N8N_ENCRYPTION_KEYsomewhere safe. Without it, your stored credentials cannot be decrypted. - Enable the provider's weekly snapshots.
- Dump the database regularly:
docker compose exec postgres pg_dump -U n8n n8n > backup.sql. - Export workflows as JSON or connect Git (paid feature) for version history.
Step 6: Update safely
docker compose pull
docker compose up -d
Take a snapshot before major version upgrades and read the release notes.
How big a server do you need?
| Workload | Suggested size |
|---|---|
| A few workflows, light schedules | 1 vCPU, 1–2 GB RAM |
| Dozens of workflows, webhooks, moderate volume | 2 vCPU, 4 GB RAM |
| Heavy volume or large files and AI workflows | 4 vCPU, 8 GB RAM, consider queue mode with Redis |

