How to Self-Host n8n on a $5 VPS
Why I Stopped Using n8n Cloud and Moved to a $5 VPS
If you want to self-host n8n without spending a fortune, a $5 VPS is genuinely all you need for most small-to-medium automation workloads. I made the switch six months ago after my n8n Cloud bill crept past £40/month — and my self-hosted instance now handles over 300 workflow executions a day on a server that costs me $6 at Hetzner. Here's exactly how I set it up, including the mistakes I made so you don't have to.
What You'll Need Before You Start
No DevOps background required. Seriously. If you can copy-paste commands into a terminal, you can do this in under an hour.
- A VPS: I use Hetzner CX11 (1 vCPU, 2 GB RAM, €3.79/month). DigitalOcean's $6 Droplet or Vultr's $5 plan work just as well.
- A domain name: You need a subdomain pointing to your server — something like
n8n.yourdomain.com. Cloudflare for DNS management is free and excellent. - Basic terminal access: Any SSH client. On Mac/Linux that's your built-in terminal. On Windows, use PuTTY or Windows Terminal.
- Docker + Docker Compose: This is how we'll run n8n. Much cleaner than a bare Node.js install.
Step-by-Step: Self-Host n8n with Docker Compose
Spin up your VPS with Ubuntu 22.04. SSH in, then run the following to get Docker installed:
curl -fsSL https://get.docker.com | sh
Once Docker is running, create a directory for your n8n setup:
mkdir ~/n8n && cd ~/n8n
Now create a docker-compose.yml file. Here's the exact config I use in production:
version: "3"
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.yourdomain.com/
- GENERIC_TIMEZONE=Europe/London
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=yourpassword
volumes:
- ~/.n8n:/home/node/.n8n
Start it with docker compose up -d. Your n8n instance is now running on port 5678. But don't expose that port directly — you need a reverse proxy with SSL.
Setting Up Nginx + Certbot for HTTPS
Install Nginx and Certbot:
sudo apt install nginx certbot python3-certbot-nginx -y
Create an Nginx config at /etc/nginx/sites-available/n8n that proxies traffic from your subdomain to port 5678. Then run certbot --nginx -d n8n.yourdomain.com and follow the prompts. Certbot will auto-renew your SSL certificate — no manual work needed.
Point your subdomain's A record to your VPS IP in Cloudflare, wait a minute or two for DNS to propagate, and you'll have a fully live, HTTPS-secured n8n instance.
Real-World Example: A Client's Lead Capture Workflow
One of my clients — a UK-based mortgage broker — was paying £79/month for Zapier to run a lead capture workflow. The flow was simple: Typeform submission → enrich with Clearbit → push to HubSpot → send a Slack notification. Four steps, running maybe 200 times a month.
We migrated the entire thing to self-hosted n8n on a Hetzner CX11. Total migration time: 90 minutes, including setting up the server. Total monthly cost now: €3.79. That's a saving of roughly £900 a year — and performance is actually better because we're not hitting Zapier's rate limits.
The workflow also gained new capabilities we couldn't afford to build on Zapier: a sub-workflow that checks for duplicate leads against their CRM before insertion, and a retry mechanism if Clearbit returns no data first time. n8n's self-hosted version has zero execution limits. That changes what you're willing to build.
Common Mistakes When You Self-Host n8n
- Skipping backups: Your workflows live in
~/.n8n. Set up a dailyrsyncor use Hetzner's snapshot feature. I've been caught out by this once — it's not fun rebuilding 40 workflows from memory. - Using SQLite in production: The default database is SQLite, which is fine for light use. Once you're running 500+ executions per day, switch to PostgreSQL. Add a Postgres service to your Docker Compose file and point n8n at it with the
DB_TYPEenvironment variable. - Not setting resource limits: Add memory limits to your Docker Compose config (
mem_limit: 1g) so a runaway workflow doesn't take down your whole server. - Leaving basic auth on forever: Basic auth is a good starting point, but look into n8n's built-in user management (available from v0.214+) for a proper multi-user setup.
- Exposing port 5678 publicly: Always put Nginx in front. Never expose the n8n port directly.
Is a $5 VPS Enough? Honest Answer.
For 90% of use cases, yes. I run personal projects and two client environments on a single Hetzner CX21 (2 vCPU, 4 GB RAM, €5.77/month) without any issues. CPU usage barely tickles 5% at peak. RAM sits around 600 MB with n8n, Nginx, and a lightweight Postgres instance all running together.
Where you'll hit limits: if you're running CPU-intensive JavaScript in Function nodes at scale, or if you have dozens of active polling workflows (each one runs on a timer and eats a tiny bit of RAM). In that case, scale to the next tier — still massively cheaper than any SaaS alternative.
The other consideration is uptime. A $5 VPS doesn't come with an SLA that'll satisfy enterprise clients. If you're building mission-critical automations, budget for a managed Kubernetes setup or at least a server with automated failover. For everything else, a simple VPS with Docker is rock solid.
Ready to Make the Switch?
Self-hosting n8n is one of those decisions that feels slightly intimidating until you've done it once, and then you wonder why you ever paid cloud prices. A $5 VPS, Docker Compose, and an hour of your time is genuinely all it takes.
If you'd rather skip the setup entirely and have someone do it properly — with backups, Postgres, SSL, and a sensible folder structure — that's exactly the kind of thing we handle at Esipick. Drop me a message and we'll get you sorted.
— Ali, Esipick
Want this automated for your business?
I build n8n workflows, WhatsApp automations, and AI pipelines — starting from $300. Most go live in under a week.
Get a Free Audit →