Bottom line: you can run n8n production-style on a 1–2 GB VPS for $5–7/mo. For anyone running more than a couple of test workflows, self-hosting n8n pays for itself almost immediately — the paid cloud plans run more per month than a year of VPS.
Spec note: n8n on a 1 GB box is fine for light-to-moderate workflows. If you're running many scheduled jobs, a 2 GB box gives comfortable headroom. See the RAM sizing guide for the workload thresholds.
Why self-host n8n
- Cost: a VPS is a flat few dollars a month; n8n cloud scales with executions and adds up.
- Control: your data, your node library, your rate limits, no per-workflow pricing.
- Run forever: a workflow that ticks every 5 minutes costs the same as one that never runs.
The 1-command Docker setup (local/test only)
n8n runs great in Docker. For a quick local test on a fresh VPS:
# assume Docker is installed — see our Docker starter stack
mkdir -p ~/n8n && cd ~/n8n
docker run -d --name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
-e N8N_SECURE_COOKIE=false \
n8nio/n8n
⚠️ Local/test only — do not use this for production. This binds n8n on port 5678 with no TLS and N8N_SECURE_COOKIE=false. If this is exposed beyond localhost, anyone can hit your instance on http://your-vps:5678 in plaintext, and the insecure-cookie flag weakens session protection. It's fine for a 10-minute smoke test on 127.0.0.1; do not point it at a public IP.
The production path: Docker Compose + Caddy (TLS)
For anything you're going to actually run automation on, front n8n with Caddy so it gets automatic HTTPS and a secure cookie. This is the setup we recommend — it's barely more work than the one-liner above and it's the difference between "runs" and "safe to run."
# ~/n8n/docker-compose.yml (n8n + Caddy, automatic TLS)
services:
n8n:
image: n8nio/n8n
environment:
- N8N_HOST=automation.yourdomain.com
- N8N_PROTOCOL=https
- N8N_PORT=5678
volumes:
- n8n_data:/home/node/.n8n
# port 5678 stays INTERNAL — only Caddy is exposed
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
volumes:
n8n_data:
caddy_data:
# Caddyfile — automatic Let's Encrypt TLS, only port 443 exposed
automation.yourdomain.com {
reverse_proxy n8n:5678
}
With this, n8n is only reachable internally on port 5678; the only public exposure is port 443 (HTTPS) via Caddy. Set N8N_SECURE_COOKIE=true here — n8n is behind TLS, so the secure cookie is correct and expected.
Realistic VPS needs
| Workload | RAM | Good pick |
|---|---|---|
| A few hobby workflows | 1 GB | $1.5–6 |
| Active production automation | 2 GB | ~$7–12 |
| n8n + other services (Uptime Kuma, etc.) | 2 GB+ | Scale up |
New to VPS hosting entirely? Read when a VPS makes sense and lock it down first.