Introduction
n8n is the most powerful free automation tool — but only if you self-host it. The cloud version costs $20/month. Self-hosted n8n is free and unlimited: run as many workflows as you want, on your own server, with your data staying private.
This post shows you how to self-host n8n with Docker, set up a reverse proxy with SSL, and back up your data.
What you need
- A VPS (Virtual Private Server) — $5-10/month (DigitalOcean, Hetzner, Linode)
- A domain name (optional, for HTTPS)
- Basic Docker knowledge (or willingness to learn)
Total cost: $5-10/month for the server. Everything else is free.
Step 1: Set up your VPS
Recommended providers
| Provider | Price | Specs | Best for |
|---|---|---|---|
| Hetzner | €4.5/mo | 2 vCPU, 4GB RAM, 40GB SSD | Best value |
| DigitalOcean | $6/mo | 1 vCPU, 1GB RAM, 25GB SSD | Easiest setup |
| Linode | $5/mo | 1 vCPU, 1GB RAM, 25GB SSD | Good balance |
| Oracle Cloud | Free | 2 vCPU, 1GB RAM (ARM) | Free forever (limited) |
Initial server setup
# SSH into your server
ssh root@your-server-ip
# Update system
apt update && apt upgrade -y
# Install Docker
curl -fsSL https://get.docker.com | sh
# Install Docker Compose
apt install docker-compose-plugin -y
# Create a non-root user
adduser n8n
usermod -aG docker n8n
su - n8n
Step 2: Docker Compose setup
Create docker-compose.yml:
version: "3.8"
services:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.yourdomain.com/
- GENERIC_TIMEZONE=Asia/Kolkata
- TZ=Asia/Kolkata
- N8N_ENCRYPTION_KEY=your-random-encryption-key-here
volumes:
- n8n_data:/home/node/.n8n
networks:
- n8n-network
# Optional: PostgreSQL for better performance
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=your-db-password
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- n8n-network
# Nginx reverse proxy with SSL
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./certs:/etc/nginx/certs
depends_on:
- n8n
networks:
- n8n-network
volumes:
n8n_data:
postgres_data:
networks:
n8n-network:
Step 3: Nginx reverse proxy with SSL
Create nginx.conf:
events {}
http {
server {
listen 80;
server_name n8n.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name n8n.yourdomain.com;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
location / {
proxy_pass http://n8n: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;
proxy_read_timeout 86400;
client_max_body_size 50M;
}
}
}
Get SSL certificate (Let’s Encrypt)
# Install certbot
apt install certbot python3-certbot-nginx -y
# Get certificate
certbot certonly --standalone -d n8n.yourdomain.com
# Copy certs
mkdir -p certs
cp /etc/letsencrypt/live/n8n.yourdomain.com/fullchain.pem certs/
cp /etc/letsencrypt/live/n8n.yourdomain.com/privkey.pem certs/
Step 4: Start n8n
docker compose up -d
Visit https://n8n.yourdomain.com and create your admin account.
Step 5: Configure n8n
Essential settings
- Settings → General: Set timezone, language
- Settings → Users: Create additional users if needed
- Settings → API: Generate API key for external integrations
Environment variables (optional)
# Add to docker-compose.yml environment section
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your-secure-password
- EXECUTIONS_DATA_SAVE_ON_ERROR=all
- EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
- EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
Step 6: Back up your data
Automated backup script
#!/bin/bash
# backup_n8n.sh
BACKUP_DIR="/home/n8n/backups"
DATE=$(date +%Y%m%d_%H%M%S)
# Backup n8n data volume
docker run --rm -v n8n_data:/data -v $BACKUP_DIR:/backup alpine \
tar czf /backup/n8n_backup_$DATE.tar.gz -C /data .
# Backup PostgreSQL
docker exec postgres pg_dump -U n8n n8n > $BACKUP_DIR/db_backup_$DATE.sql
# Upload to cloud (optional)
# rclone copy $BACKUP_DIR remote:n8n-backups/
# Clean up old backups (keep 7 days)
find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete
find $BACKUP_DIR -name "*.sql" -mtime +7 -delete
echo "Backup completed: $DATE"
Schedule with cron:
0 2 * * * /home/n8n/backup_n8n.sh
Step 7: Update n8n
# Pull latest image
docker compose pull
# Restart with new image
docker compose up -d
# Check version
docker compose exec n8n n8n --version
n8n vs Zapier vs Make
| n8n (self-hosted) | Zapier | Make | |
|---|---|---|---|
| Cost | $5-10/mo (server only) | $20-50/mo | $9-29/mo |
| Executions | Unlimited | 750-2,000/mo | 10,000-40,000/mo |
| Integrations | 400+ (extensible) | 6,000+ | 1,500+ |
| Custom code | Full (JS/Python) | Limited | Limited |
| Privacy | Your server | Cloud | Cloud |
| Maintenance | You maintain it | Managed | Managed |
| Best for | Developers, cost-conscious | Beginners, simple flows | Complex workflows |
Common mistakes
- No SSL — webhooks require HTTPS. Always set up SSL.
- No backups — if your server dies, you lose all workflows. Back up daily.
- Weak encryption key — use a strong, random key. If you lose it, you can’t decrypt credentials.
- Not updating — n8n releases updates frequently. Update monthly.
- Using SQLite in production — switch to PostgreSQL for better performance.
- No monitoring — set up UptimeRobot to alert you if n8n goes down.
Key Concepts
- Self-hosting = running software on your own server
- Docker = containerization platform
- Reverse proxy = nginx in front of n8n (SSL, routing)
- Webhook = HTTP endpoint for triggering workflows
- Encryption key = key for encrypting credentials in n8n
- VPS = Virtual Private Server (cloud server)
What to Try Next
- Zapier vs Make vs n8n — comparison
- Build your first Zapier automation — no-code alternative
- Google Sheets + Apps Script automations — free
- When to use no-code vs Python for automation
FAQ
How much does self-hosting n8n cost?
Server: $5-10/month (Hetzner, DigitalOcean). Domain: $10-15/year. SSL: free (Let’s Encrypt). Total: ~$5-10/month for unlimited automations.
Is self-hosted n8n reliable?
Yes — with proper setup (Docker, auto-restart, backups, monitoring). Many companies run n8n in production. The main risk is server maintenance, which is minimal with Docker.
Can I use n8n without a domain?
Yes — use your server’s IP address with HTTP (no SSL). But webhooks (for external triggers) require HTTPS. For production, get a domain and SSL.
n8n vs Zapier for a small business?
If you’re technical and want free/unlimited: n8n self-hosted. If you want zero maintenance and have budget: Zapier. Most small businesses start with Zapier and migrate to n8n when they outgrow the free tier. See Zapier vs Make vs n8n. See Build First Zapier Automation. See Google Sheets Apps Script Automations. See 25 Business Automations. See No-Code vs Python. See How Much Does Automation Cost. See Automate Google Review Requests. See Automate Customer Follow-Ups. See Automate Invoices. See Automate Appointment Reminders. See Automate Lead Follow-Up Emails. See Automate SEO Reports. See Automate Monthly Reports. See Automate Expense Tracking. See Automate Data Entry from PDFs. See Automate Payroll Reminders. See Automate Birthday/Anniversary Offers. See Automate Feedback Surveys. See Export Google Reviews (Python). See Capture Leads into Google Sheets. See WhatsApp Lead Alerts. See Automate Lead Follow-Up Emails. See Auto-Reply Instagram/Facebook. See Simple CRM in Google Sheets. See Score and Sort Leads. See Scrape Business Leads from Google Maps. See Automate Appointment Reminders. See Auto-Booking System. See Connect Website Form to WhatsApp. See Automate Invoices. See Bulk PDF Invoices. See Auto-Generate GST Invoices. See Automate Expense Tracking from Bank SMS. See Auto-Send Monthly Reports. See Auto-Backup Business Files. See Automate Data Entry from PDFs. See Auto-Rename Downloads. See Automate Payroll Reminders. See Track Domain/SSL Expiry. See Schedule GBP Posts. See Schedule Social Media Posts. See Repurpose Blog Posts with AI. See Automate Email Newsletter. See Auto-Post Blog to Social. See Bulk Product Descriptions with AI. See Automate SEO Reports. See Monitor Competitor Prices. See Track Google Rankings. See GBP Post Ideas. See Setup WhatsApp Business. See WhatsApp Review Requests. See Review Request System (Google Sheets). See Automate Customer Follow-Ups. See Automate Birthday/Anniversary Offers. See Automate Feedback Surveys. See Export Google Reviews (Python). See Capture Leads into Google Sheets. See WhatsApp Lead Alerts. See Automate Lead Follow-Up Emails. See Auto-Reply Instagram/Facebook. See Simple CRM in Google Sheets. See Score and Sort Leads. See Scrape Business Leads from Google Maps. See Automate Appointment Reminders. See Auto-Booking System. See Connect Website Form to WhatsApp. See Automate Invoices. See Bulk PDF Invoices. See Auto-Generate GST Invoices. See Automate Expense Tracking from Bank SMS. See Auto-Send Monthly Reports. See Auto-Backup Business Files. See Automate Data Entry from PDFs. See Auto-Rename Downloads. See Automate Payroll Reminders. See Track Domain/SSL Expiry. See Schedule GBP Posts. See Schedule Social Media Posts. See Repurpose Blog Posts with AI. See Automate Email Newsletter. See Auto-Post Blog to Social. See Bulk Product Descriptions with AI. See Automate SEO Reports. See Monitor Competitor Prices. See Track Google Rankings. See GBP Post Ideas. See Setup WhatsApp Business. See WhatsApp Review Requests. See Review Request System (Google Sheets). See Automate Customer Follow-Ups. See Automate Birthday/Anniversary Offers. See Automate Feedback Surveys. See Export Google Reviews (Python). See Capture Leads into Google Sheets. See WhatsApp Lead Alerts. See Automate Lead Follow-Up Emails. See Auto-Reply Instagram/Facebook. See Simple CRM in Google Sheets. See Score and Sort Leads. See Scrape Business Leads from Google Maps. See Automate Appointment Reminders. See Auto-Booking System. See Connect Website Form to WhatsApp. See Automate Invoices. See Bulk PDF Invoices. See Auto-Generate GST Invoices. See Automate Expense Tracking from Bank SMS. See Auto-Send Monthly Reports. See Auto-Backup Business Files. See Automate Data Entry from PDFs. See Auto-Rename Downloads. See Automate Payroll Reminders. See Track Domain/SSL Expiry. See Schedule GBP Posts. See Schedule Social Media Posts. See Repurpose Blog Posts with AI. See Automate Email Newsletter. See Auto-Post Blog to Social. See Bulk Product Descriptions with AI. See Automate SEO Reports. See Monitor Competitor Prices. See Track Google Rankings. See GBP Post Ideas. See Setup WhatsApp Business. See WhatsApp Review Requests. See Review Request System (Google Sheets). See Automate Customer Follow-Ups. See Automate Birthday/Anniversary Offers. See Automate Feedback Surveys. See Export Google Reviews (Python). See Capture Leads into Google Sheets. See WhatsApp Lead Alerts. See Automate Lead Follow-Up Emails. See Auto-Reply Instagram/Facebook. See Simple CRM in Google Sheets. See Score and Sort Leads. See Scrape Business Leads from Google Maps. See Automate Appointment Reminders. See Auto-Booking System. See Connect Website Form to WhatsApp. See Automate Invoices. See Bulk PDF Invoices. See Auto-Generate GST Invoices. See Automate Expense Tracking from Bank SMS. See Auto-Send Monthly Reports. See Auto-Backup Business Files. See Automate Data Entry from PDFs. See Auto-Rename Downloads. See Automate Payroll Reminders. See Track Domain/SSL Expiry. See Schedule GBP Posts. See Schedule Social Media Posts. See Repurpose Blog Posts with AI. See Automate Email Newsletter. See Auto-Post Blog to Social. See Bulk Product Descriptions with AI. See Automate SEO Reports. See Monitor Competitor Prices. See Track Google Rankings. See GBP Post Ideas. See Setup WhatsApp Business. See WhatsApp Review Requests. See Review Request System (Google Sheets). See Automate Customer Follow-Ups. See Automate Birthday/Anniversary Offers. See Automate Feedback Surveys. See Export Google Reviews (Python). See Capture Leads into Google Sheets. See WhatsApp Lead Alerts. See Automate Lead Follow-Up Emails. See Auto-Reply Instagram/Facebook. See Simple CRM in Google Sheets. See Score and Sort Leads. See Scrape Business Leads from Google Maps. See Automate Appointment Reminders. See Auto-Booking System. See Connect Website Form to WhatsApp. See Automate Invoices. See Bulk PDF Invoices. See Auto-Generate GST Invoices. See Automate Expense Tracking from Bank SMS. See Auto-Send Monthly Reports. See Auto-Backup Business Files. See Automate Data Entry from PDFs. See Auto-Rename Downloads. See Automate Payroll Reminders. See Track Domain/SSL Expiry. See Schedule GBP Posts. See Schedule Social Media Posts. See Repurpose Blog Posts with AI. See Automate Email Newsletter. See Auto-Post Blog to Social. See Bulk Product Descriptions with AI. See Automate SEO Reports. See Monitor Competitor Prices. See Track Google Rankings.
What to Try Next
- Automate SEO reports for clients
- Monitor competitor prices automatically
- Track Google rankings for free
- Build an SEO dashboard in Streamlit