n8n Cloud starts at $20/month. A DigitalOcean Droplet that runs n8n just as well costs $6-12/month — and you get full control, no workflow execution limits, and unlimited integrations. This complete 2026 guide walks you through every step of self-hosting n8n on DigitalOcean, from creating your server to accessing n8n via HTTPS with a custom domain.
⚡ What You'll Build
✅ n8n running 24/7 on your own DigitalOcean server
✅ Accessible via your custom domain with free SSL (HTTPS)
✅ Auto-restarting with Docker
✅ Basic auth protection
💰 Total cost: ~$6-12/month (vs $20+/month on n8n Cloud)
🎁 New DigitalOcean users get $200 free credits →
- Prerequisites
- Step 1: Create a DigitalOcean Account
- Step 2: Create a Droplet (Server)
- Step 3: Connect to Your Server via SSH
- Step 4: Install Docker & Docker Compose
- Step 5: Configure n8n with Docker Compose
- Step 6: Set Up Nginx Reverse Proxy
- Step 7: Enable Free SSL with Let's Encrypt
- Step 8: Access Your n8n Instance
- Pro Tips & Best Practices
- FAQ
Prerequisites
Before you start, make sure you have:
- ✅ A DigitalOcean account (new users get $200 free credits)
- ✅ A domain name (e.g.,
n8n.yourdomain.com) — from Namecheap, Cloudflare, etc. - ✅ Basic comfort with terminal / command line (copy-paste commands is enough)
- ✅ SSH client — Terminal (Mac/Linux) or Putty/Windows Terminal (Windows)
⏱️ Estimated time to complete: 30-45 minutes
Step 1: Create a DigitalOcean Account
Go to DigitalOcean.com and sign up. New accounts receive $200 in free credits valid for 60 days — more than enough to run and test your n8n setup for free.
After signing up, you'll land on the DigitalOcean control panel (dashboard). This is where you'll create and manage your server (called a "Droplet" on DigitalOcean).
Step 2: Create a Droplet (Your Cloud Server)
A Droplet is DigitalOcean's term for a virtual private server (VPS). For n8n, we recommend:
| Usage | Droplet Size | Cost/Month | RAM |
|---|---|---|---|
| Light (personal automation) | Basic — 1 vCPU, 1GB RAM | $6/month | 1GB |
| Recommended ✅ | Basic — 1 vCPU, 2GB RAM | $12/month | 2GB |
| Heavy (many workflows/users) | Basic — 2 vCPU, 4GB RAM | $24/month | 4GB |
Droplet Configuration:
- Click "Create" → "Droplets" in the top menu
- Region: Choose the closest to your location (e.g., New York, London, Singapore)
- OS: Select Ubuntu 24.04 LTS (64-bit)
- Plan: Basic → Shared CPU → $12/month (1 vCPU, 2GB RAM)
- Authentication: SSH Key (recommended) or Password
- Click "Create Droplet"
✅ Your Droplet will be ready in about 60 seconds. Note down the IP address shown on the dashboard.
Step 3: Point Your Domain to the Droplet
Before connecting, point your subdomain to the Droplet's IP address:
- Go to your domain registrar (Namecheap, Cloudflare, etc.)
- Add an A Record:
Type: A
Host: n8n (or automation, or any subdomain you want)
Value: YOUR_DROPLET_IP_ADDRESS
TTL: 300 (5 minutes)
This creates n8n.yourdomain.com pointing to your server. DNS propagation takes
5-30 minutes.
Step 4: Connect to Your Server via SSH
Open your terminal and connect:
ssh root@YOUR_DROPLET_IP
Type yes when asked to verify the fingerprint. You're now inside your server!
First, update the system packages:
apt update && apt upgrade -y
Step 5: Install Docker & Docker Compose
Docker lets us run n8n in an isolated container — it's easier to manage, update, and restart than a bare-metal installation.
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
# Install Docker Compose plugin
apt install -y docker-compose-plugin
# Verify installation
docker --version
docker compose version
✅ You should see version numbers confirming Docker is installed.
Step 6: Configure n8n with Docker Compose
Create a directory for n8n and a Docker Compose file:
mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml
Paste this configuration (replace the values in ALL_CAPS):
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=n8n.YOURDOMAIN.COM
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.YOURDOMAIN.COM/
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=YOUR_USERNAME
- N8N_BASIC_AUTH_PASSWORD=YOUR_STRONG_PASSWORD
- N8N_ENCRYPTION_KEY=YOUR_RANDOM_32_CHAR_STRING
- GENERIC_TIMEZONE=Asia/Dhaka
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Save the file: press Ctrl+X, then Y, then Enter.
Start n8n:
docker compose up -d
✅ n8n is now running on port 5678. Next, we'll put Nginx in front of it with SSL.
Step 7: Set Up Nginx Reverse Proxy
Nginx acts as a gateway — it receives requests on port 80/443 (web) and forwards them to n8n on port 5678.
# Install Nginx
apt install -y nginx
# Create n8n config
nano /etc/nginx/sites-available/n8n
Paste this configuration (replace n8n.YOURDOMAIN.COM):
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;
proxy_cache_bypass $http_upgrade;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_read_timeout 300s;
}
}
Enable the config:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
Step 8: Enable Free SSL with Let's Encrypt
Install Certbot to get a free SSL certificate:
# Install Certbot
apt install -y certbot python3-certbot-nginx
# Get SSL certificate (replace with your domain + email)
certbot --nginx -d n8n.YOURDOMAIN.COM --email YOUR@EMAIL.COM --agree-tos --no-eff-email
✅ Certbot automatically modifies your Nginx config to use HTTPS and auto-renews every 90 days.
Reload Nginx:
systemctl reload nginx
Step 9: Access Your n8n Instance
Open your browser and go to:
https://n8n.YOURDOMAIN.COM
You'll see a username/password prompt — enter the credentials you set in
N8N_BASIC_AUTH_USER and N8N_BASIC_AUTH_PASSWORD.
Then you'll see the n8n setup wizard. Create your admin account and you're ready to build workflows! 🎉
Pro Tips & Best Practices
🔄 Updating n8n
Pull the latest n8n image and restart:
cd ~/n8n
docker compose pull
docker compose up -d
💾 Backup Your n8n Data
n8n stores workflows and credentials in the n8n_data Docker volume. To back up:
# Create a backup
docker run --rm -v n8n_data:/data -v $(pwd):/backup ubuntu tar czf /backup/n8n-backup-$(date +%Y%m%d).tar.gz /data
💡 Enable DigitalOcean's Automated Backups ($0.20/GB/month) for your Droplet — it takes full server snapshots weekly.
🔒 Enable DigitalOcean Firewall
In your DigitalOcean dashboard, add a firewall to your Droplet:
- Allow Port 22 (SSH) from your IP only
- Allow Port 80 and 443 (HTTP/HTTPS) from all
- Block everything else
📊 n8n Self-Hosted vs n8n Cloud — Cost Comparison
| Option | Monthly Cost | Workflow Executions | Control |
|---|---|---|---|
| Self-Host (DigitalOcean $12/mo) | $12/month | Unlimited | ✅ Full |
| n8n Cloud Starter | $20/month | 2,500/month | ❌ Limited |
| n8n Cloud Pro | $50/month | 10,000/month | ❌ Limited |
| n8n Cloud Enterprise | $170/month | 50,000/month | ❌ Limited |
💡 Savings: Self-hosting saves $8-158/month vs n8n Cloud, with unlimited executions. The $200 DigitalOcean credit gives you ~16 months of the $12 plan free.
→ See: n8n Tutorial for Beginners 2026 →
→ See: Best Zapier Alternatives 2026 →