AI Automation & Self-Hosting Specialist
n8n is a powerful, open-source workflow automation platform that rivals Zapier and Make but gives you complete control over your data. If you’re a developer or AI enthusiast tired of paying per-action fees, self-hosting n8n on a budget VPS is the perfect solution.
In this guide, I’ll show you how to deploy n8n on an affordable VPS for under $5/month, complete with SSL encryption, persistent storage, and automatic backups. By the end, you’ll have a production-ready automation engine that costs a fraction of commercial alternatives.
Why Self-Host n8n Instead of Using Zapier or Make?
The three main reasons developers choose self-hosted n8n:
- Cost control: Zapier and Make charge per execution. With n8n on a $4 VPS, unlimited workflows with no per-action fees.
- Data privacy: Your workflows, credentials, and execution logs stay on your infrastructure. No third-party API calls required.
- Custom integrations: n8n’s JavaScript/Python nodes let you build custom logic directly in workflows without external apps.
For teams running 10+ daily workflows or handling sensitive data (API keys, customer databases, etc.), self-hosting n8n saves thousands annually.
System Requirements & VPS Choice
n8n is lightweight but benefits from adequate resources:
| Component | Minimum | Recommended |
|---|---|---|
| CPU | 2 cores | 4 cores (better workflow concurrency) |
| RAM | 2GB | 4GB (smoother for 20+ active workflows) |
| Storage | 20GB SSD | 40GB SSD (room for execution logs) |
| Bandwidth | Unlimited (if workflows call external APIs) | Unlimited |
Best VPS for n8n in 2026:
- Contabo VPS M (4 cores, 8GB RAM, 400GB SSD) — $8.99/month — Best bang for buck. Includes unlimited traffic and storage. Perfect for production n8n setups.
- Contabo VPS S (2 cores, 4GB RAM, 200GB SSD) — $4.99/month — Great for testing or light workflows (less than 10 concurrent runs).
- Linode Nanode (1 core, 1GB RAM) — $5/month — Tight fit; only for demo purposes.
I recommend Contabo VPS M as your starting point. The extra CPU and RAM cost only $4/month more but handle production loads without bottlenecks. Check Contabo’s full VPS lineup here.
Step 1: Provision Your VPS
- Sign up for Contabo VPS (or your preferred provider).
- Select Ubuntu 22.04 LTS or Debian 12 as your OS.
- Add your SSH public key during setup.
- Create a new SSH key pair locally if you don’t have one:
ssh-keygen -t ed25519 -C "n8n-vps" - Once deployed, SSH into your VPS:
ssh root@YOUR_VPS_IP
Step 2: Install Docker & Docker Compose
n8n runs best in Docker. Install it with:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
docker --version
Install Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
Step 3: Create n8n Docker Compose Configuration
Create a working directory and compose file:
mkdir -p ~/n8n
cd ~/n8n
nano docker-compose.yml
Paste this configuration:
version: '3.9'
services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=YOUR_DOMAIN_OR_IP
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- GENERIC_TIMEZONE=Europe/Berlin
volumes:
- n8n_data:/home/node/.n8n
networks:
- n8n_network
postgres:
image: postgres:15-alpine
container_name: n8n_postgres
restart: always
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=changeme123!
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- n8n_network
volumes:
n8n_data:
postgres_data:
networks:
n8n_network:
Important: Replace YOUR_DOMAIN_OR_IP with your VPS IP or domain name, and change the PostgreSQL password to something strong.
Step 4: Set Up Nginx Reverse Proxy with SSL
n8n should be accessed over HTTPS. Install Nginx and Certbot:
sudo apt update && sudo apt install -y nginx certbot python3-certbot-nginx
Create an Nginx config:
sudo nano /etc/nginx/sites-available/n8n
Add this configuration (replace n8n.yourdomain.com with your domain):
server {
listen 80;
server_name n8n.yourdomain.com;
location / {
proxy_pass http://localhost:5678;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the site and get an SSL certificate:
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo certbot certonly --nginx -d n8n.yourdomain.com
Certbot will automatically update your Nginx config with HTTPS.
Step 5: Launch n8n
Start the Docker containers:
cd ~/n8n
docker-compose up -d
docker-compose logs -f n8n
Wait for the output: Server is now ready. Then visit https://n8n.yourdomain.com in your browser. You’ll be prompted to create a user account on first login.
Step 6: Configure Backups & Persistence
Your n8n data lives in Docker volumes. Back them up weekly:
#!/bin/bash
cd ~/n8n
docker-compose exec -T postgres pg_dump -U n8n n8n > n8n_backup_$(date +%Y%m%d_%H%M%S).sql
tar -czf n8n_volume_backup_$(date +%Y%m%d_%H%M%S).tar.gz n8n_data/
echo "Backup complete"
Schedule it with cron:
crontab -e
0 2 * * 0 /home/user/backup-n8n.sh
Cost Breakdown: Monthly VPS Cost vs. Zapier/Make
| Service | 10 Workflows | 50 Workflows |
|---|---|---|
| Zapier Pro | $600+/month (20k tasks) | $2000+/month |
| Make Unlimited | $30/month | $30/month |
| Self-Hosted n8n (Contabo VPS M) | $8.99/month | $8.99/month |
Even compared to Make’s unlimited plan, self-hosted n8n pays for itself in one month if you’re running 50+ workflows.
Troubleshooting Common Issues
n8n won’t start: Check Docker logs:
docker-compose logs n8n
Workflow executions are slow: Increase VPS resources or upgrade to a higher Contabo VPS tier.
SSL certificate renewal fails:
sudo certbot renew --dry-run
sudo systemctl restart nginx
Out of disk space: Check Docker logs size:
docker system prune -a --volumes
Next Steps: Advanced Optimization
- Enable Redis caching — Dramatically speeds up workflow execution. Add to docker-compose.yml and set
N8N_CACHE_ENABLED=redis. - Use a managed PostgreSQL database — Offload database management to Contabo’s managed services for better uptime.
- Set up webhook endpoints — Trigger workflows from external services, Telegram bots, AI agents, etc.
- Integrate with AI models — Use n8n’s HTTP node to call OpenAI, Claude, or local LLMs for intelligent workflow automation.
Conclusion
Self-hosting n8n on a budget VPS is straightforward and saves thousands annually compared to Zapier or Make. With Contabo’s affordable VPS plans, you get production-grade infrastructure for under $10/month, complete control over your automation workflows, and the ability to integrate private data and custom logic without restrictions.
Start with the VPS M plan, deploy n8n following this guide, and you’ll have a powerful, scalable automation platform running within 30 minutes.
Ready to get started? Provision your Contabo VPS today and join hundreds of developers running private automation infrastructure.
This article was produced with the assistance of AI tools and reviewed by the AIStackDigest editorial team.
