Self-Hosting n8n on a $6/mo VPS with Docker: Production Guide (2026)
The SaaS Pricing Problem: As your business scales to 50,000 monthly automation tasks, Zapier bills you $350 to $600 every single month. By deploying n8n on your own private Virtual Private Server (VPS), you get unlimited executions, faster webhook processing, and complete data sovereignty for under $10/month.
1. The Economics: $6/mo VPS vs. $500/mo Zapier
Modern businesses often find themselves penalized by SaaS pricing models simply for growing. Here is a real-world cost comparison at 50k and 200k operations per month:
| Metric | Zapier Team Tier | Make.com Pro | n8n on Private VPS |
|---|---|---|---|
| 50,000 Tasks/mo | $399 / mo | $75 / mo | $6 / mo (Hetzner 4GB RAM) |
| 200,000 Tasks/mo | $1,299 / mo | $269 / mo | $12 / mo (Hetzner 8GB RAM) |
| Execution Limits | Hard-capped | Hard-capped | Unlimited |
| Data Privacy | Public Cloud | Public Cloud | Private isolated VPC |
2. Production Docker Compose Architecture
Never run self-hosted n8n on SQLite in production. A resilient setup uses PostgreSQL 16 with dedicated volume persistence and health checks:
version: '3.8'
services:
postgres:
image: postgres:16-alpine
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: n8n
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -h localhost -U ${POSTGRES_USER} -d n8n"]
interval: 5s
timeout: 5s
retries: 10
n8n:
image: docker.n8n.io/n8nio/n8n:latest
restart: always
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=${POSTGRES_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
- N8N_HOST=n8n.yourcompany.com
- WEBHOOK_URL=https://n8n.yourcompany.com/
- EXECUTIONS_DATA_PRUNE=true
- EXECUTIONS_DATA_MAX_AGE=168
ports:
- "127.0.0.1:5678:5678"
depends_on:
postgres:
condition: service_healthy
volumes:
- n8n_data:/home/node/.n8n
volumes:
postgres_data:
n8n_data:
3. Automatic SSL & Reverse Proxy with Caddy
Instead of manually managing Let's Encrypt certificates with Certbot, use Caddy as a zero-config reverse proxy:
n8n.yourcompany.com {
reverse_proxy 127.0.0.1:5678
}
Caddy automatically provisions, verifies, and renews your TLS certificates with zero manual intervention.
4. Hardening, Non-Root Users & Daily S3 Backups
A production server must be locked down against security threats:
- UFW Firewall: Allow only ports 22 (SSH with key-only auth), 80 (HTTP), and 443 (HTTPS). Block direct access to port 5678.
- Execution Pruning: Automatically prune execution logs older than 7 days (168 hours) to prevent disk space bloat.
- Automated S3 Backup: Run a daily
pg_dumpcron script that pushes encrypted database archives to Cloudflare R2 or Amazon S3.
Frequently Asked Questions
Why choose self-hosted n8n over n8n Cloud or Zapier?
Self-hosting grants unlimited workflow executions, zero per-task fees, access to native Python code execution, and 100% data privacy within your own server infrastructure.
What server specs are needed for a small business setup?
A standard $6 to $12/month VPS (e.g. Hetzner, DigitalOcean, Contabo) with 2 vCPUs, 4GB RAM, and 40GB SSD easily handles 50,000+ monthly workflow executions.
How are database backups handled in production?
We configure a daily automated cron job that dumps the PostgreSQL database, encrypts the snapshot, and syncs it offsite to Amazon S3 or Cloudflare R2.
Need a hardened, private n8n instance set up for your team?
Book a free scoping call. We will provision your private VPS, configure Docker with PostgreSQL and automated S3 backups, and migrate your existing workflows without downtime.
Deploy Private n8n Instance WhatsApp +380 99 518 6487 hello@scryptool.spaceNeed an optimized landing page for your SaaS product? Check out our conversion landing page design and CRO.