
Short answer: n8n self hosting costs about $4-7 a month for a small cloud server, takes roughly 30-45 minutes to set up with Docker, and gives you unlimited workflow executions with no per-run bill. The trade is that you become responsible for updates, backups and uptime – jobs n8n Cloud (from €20/month) handles for you. This guide sets up a production-ready instance step by step: a VPS, Docker, PostgreSQL, a domain with free HTTPS, and the backup and update habits that keep it running unattended.
We used the exact steps below on a fresh Ubuntu server while writing this guide, on a Hetzner CX23 box. Screenshots below are from that build.
Verified: September 2026, against n8n’s current Docker and one-line setup documentation. See the methodology note at the end.
Do you actually need to self-host?
Self-hosting is worth it when at least one of these is true:
- You run enough workflow volume that n8n Cloud’s execution limits (2,500/month on Starter, 10,000 on Pro) would force you onto a pricier tier.
- You need data residency, compliance, or air-gapped control that a hosted service can’t offer.
- You’re comfortable with a Linux terminal and don’t mind being the one who gets paged if something breaks.
Skip self-hosting and stay on n8n Cloud if none of that applies, or if an outage at 2am would cost you more than a subscription would. Our Zapier vs Make vs n8n pricing breakdown has the full monthly-cost comparison if you’re still deciding between hosted and self-hosted.
One thing to know before you start: n8n 3.0 requires Docker
If you’ve seen older guides that install n8n with npm install n8n or npx n8n, skip them. n8n 3.0, scheduled for release in October 2026, drops support for npm-based installs entirely – self-hosted n8n will require a Docker-based deployment from that version on. Existing npm installs keep working for now, but any new install should go straight to Docker. This guide uses Docker throughout, so you won’t need to migrate later.
What you’ll need
- A cloud server (VPS) running Ubuntu 24.04 – see recommendations below
- A domain name, or a subdomain of one you already own (e.g.
n8n.yourdomain.com) - 15 minutes to point that domain’s DNS at your server before you start (DNS changes can take time to propagate)
- Basic comfort typing commands into a terminal – you don’t need to understand every line, just be willing to copy, paste and read the output
Step 1: Choose and set up a server
n8n itself is light. A 2 vCPU / 2–4 GB RAM box comfortably runs 50+ active workflows with moderate traffic; the practical ceiling is your server’s CPU and RAM, not n8n’s software.
| Provider | Entry plan | Price (annual) | Notes |
|---|---|---|---|
| Hetzner Cloud | CX23 – 2 vCPU, 4 GB RAM, 40 GB NVMe | ~€4–6/mo | Best price-to-spec ratio; EU/US datacenters; port 25 blocked for the first ~30 days on new accounts |
| DigitalOcean | Basic Droplet – 1 vCPU, 2 GB RAM | ~$12/mo | Simple dashboard, large community of tutorials |
| Contabo | Cloud VPS 10 – 3 vCPU, 6 GB RAM | ~$5–7/mo | More RAM per dollar; smaller support team |
Steps, using Hetzner as the example (any of the three works the same way from here):
- Create an account and add a payment method.
- Create a new server: choose Ubuntu 24.04, the CX23 (or equivalent) plan, and a datacenter region close to you or your users.
- Add your SSH key during creation, or use the emailed root password if you’re not set up with SSH keys yet.
- Once it’s running, note the server’s public IP address.
Point your domain at the server now, so DNS has time to propagate while you finish the rest of the setup: in your domain registrar’s DNS settings, add an A record for n8n (or whatever subdomain you want) pointing to your server’s IP address.
Step 2: Install Docker
Connect to your server over SSH (ssh root@your-server-ip), then run:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Check it installed correctly:
docker --version
docker compose version
You need the docker compose v2 plugin specifically, not the older standalone docker-compose binary – the install script above includes it.
Step 3: Set up n8n with Docker Compose, PostgreSQL and HTTPS
n8n’s own quick-start tools (the one-line setup script) are built for local trial runs, not a production server with a domain and database. For a real deployment, write your own Docker Compose file – it’s the setup n8n’s documentation itself points to for anything beyond a local test, and it gives you a database that survives container restarts plus automatic HTTPS.
Create a project folder and the compose file:
mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml
Paste this in (replace n8n.yourdomain.com and the two password placeholders with your own values):
version: "3.8"
services:
postgres:
image: postgres:18
restart: unless-stopped
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=CHANGE_THIS_DB_PASSWORD
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
n8n:
image: n8nio/n8n:1.81.0
restart: unless-stopped
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PROTOCOL=https
- N8N_PORT=5678
- WEBHOOK_URL=https://n8n.yourdomain.com/
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=CHANGE_THIS_DB_PASSWORD
- N8N_ENCRYPTION_KEY=CHANGE_THIS_TO_A_RANDOM_STRING
- EXECUTIONS_DATA_PRUNE=true
- EXECUTIONS_DATA_MAX_AGE=336
- GENERIC_TIMEZONE=Asia/Kolkata
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- postgres
expose:
- "5678"
caddy:
image: caddy:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
volumes:
postgres_data:
n8n_data:
caddy_data:
caddy_config:
A few things worth knowing about this file:
- The n8n image is pinned to a specific version (
1.81.0), not:latest. An unpinned image can pull a breaking update automatically and take down a working setup without warning. Check the current stable version on n8n’s Docker docs and use that number. - PostgreSQL, not SQLite. n8n’s default database is a local SQLite file, which works for testing but is more prone to corruption under real load and harder to back up cleanly. Postgres is what n8n itself runs in production.
EXECUTIONS_DATA_PRUNEauto-deletes execution logs older than 336 hours (14 days). Without this, n8n keeps every execution record forever, and the database can grow to several gigabytes within a month of active use.- Caddy is the reverse proxy. It gets you free, auto-renewing HTTPS with about four lines of config – no separate Certbot setup needed.
Now create the Caddy config file:
nano Caddyfile
Paste this (again, use your own domain):
n8n.yourdomain.com {
reverse_proxy n8n:5678
}
Save and exit both files (in nano: Ctrl+O, Enter, then Ctrl+X). Now start everything:
docker compose up -d
Give it 1-2 minutes for Caddy to request and install its SSL certificate, then visit https://n8n.yourdomain.com in your browser. You should land on n8n’s setup screen – create your admin account immediately, since the first account to sign up becomes the instance owner.
Step 4: Set up automatic backups
Your workflows, credentials and execution history live in the Postgres database and the n8n_data volume. Neither survives a server failure on its own. Set up a daily backup:
mkdir -p ~/n8n-backups
nano ~/backup-n8n.sh
Paste in:
#!/bin/bash
DATE=$(date +%Y-%m-%d)
docker exec $(docker ps -qf "name=postgres") pg_dump -U n8n n8n > ~/n8n-backups/n8n-db-$DATE.sql
find ~/n8n-backups -name "*.sql" -mtime +14 -delete
Make it executable and schedule it daily via cron:
chmod +x ~/backup-n8n.sh
crontab -e
Add this line at the bottom (runs every day at 3am server time, keeps 14 days of backups):
0 3 * * * ~/backup-n8n.sh
This backs up your database locally on the same server – good for accidental deletions, not good enough for a server failure or a lost VPS. Copy the ~/n8n-backups folder off the server periodically: rsync to another machine, or upload to S3-compatible storage (Hetzner, Backblaze and most VPS providers offer this cheaply). A backup you never copy off the server you’re backing up is not really a backup.
Step 5: Update n8n safely
Because the image is pinned to a version number, updates are a deliberate step, not something that happens on its own:
- Read n8n’s release notes for the version you’re moving to, and check for breaking changes.
- Run a backup manually first:
~/backup-n8n.sh - Edit
docker-compose.ymland change the version number on then8nio/n8n:line. - Pull and restart:
docker compose pull && docker compose up -d - Open the instance and check that your key workflows still run correctly before moving on.
Don’t skip several versions at once on a production instance – update every few weeks in small steps rather than jumping from a six-month-old version straight to the newest one.
The real monthly cost
| Item | Typical cost |
|---|---|
| VPS (Hetzner CX23 or similar) | ~$4–7/month |
| Domain (if you don’t already have one) | ~$10–15/year |
| SSL certificate | Free (Caddy handles this automatically) |
| Off-server backup storage | $0–2/month for a small S3-compatible bucket |
| Total | ~$5–9/month, plus your own time |
Against n8n Cloud’s €20/month Starter plan (roughly $23), that’s a saving of about $200–620 a year – the range we calculated in our Zapier vs Make vs n8n pricing guide. The trade is your own time: budget 30–60 minutes for the initial setup, and roughly 2-4 hours a month for updates, backup checks and the odd troubleshooting session – unless something breaks at an inconvenient hour, in which case you’re the on-call engineer.
Common n8n Self-Hosting Problems and Fixes
The site loads but shows a certificate warning
Caddy hasn’t finished issuing its SSL certificate yet, or your DNS A record hasn’t propagated. Wait a few minutes and check DNS has resolved with dig n8n.yourdomain.com before troubleshooting further.
Webhooks aren’t firing
Check that WEBHOOK_URL in your compose file exactly matches your public HTTPS domain, including the trailing slash. A mismatch here is the most common cause of webhooks that work in the editor’s test mode but fail in production.
Database keeps growing
Confirm EXECUTIONS_DATA_PRUNE=true is set and that you restarted the container after adding it – environment variable changes need a restart to take effect, not just a config save.
Container won’t start after a reboot
Check restart: unless-stopped is set on all three services in your compose file (it is, in the file above). If you still see issues, run docker compose logs n8n to see the actual error.
Scheduled workflows are burning through resources
A workflow on a 5-minute schedule creates roughly 8,640 executions a month whether or not there’s real work to do each time. If a workflow can be triggered by a webhook instead of polling on a timer, that switch also reduces load on your own server, not just a hosted plan’s execution count.
Should you use queue mode?
Everything above runs n8n in its default “regular” mode, which is fine for most self-hosted setups. If you’re running thousands of executions per minute or need several workers processing jobs in parallel, n8n supports a queue mode using Redis and multiple worker containers. That’s a meaningfully more complex setup and worth its own guide – for the volume most self-hosters actually run, the setup above is the right starting point, and you can migrate to queue mode later without losing your data.
Frequently asked questions
Is self-hosted n8n really free?
The software is free and open source. You still pay for the server it runs on – typically $4–7 a month for a small VPS – plus your own time for setup and maintenance. There’s no license fee for the Community edition, and no cap on workflows or executions.
Do I need Docker to self-host n8n?
From n8n 3.0 (scheduled for October 2026), yes – self-hosted n8n will require a Docker-based deployment, and npm/npx installs will no longer be supported for new setups. Using Docker from the start, as this n8n self hosting guide does, avoids a migration later.
How much RAM does n8n need?
A 2 vCPU, 2–4 GB RAM server comfortably runs 50+ active workflows with moderate traffic for most users. High-volume or AI-heavy workflows benefit from more RAM; scale vertically first, and consider queue mode only once you’re running thousands of executions per minute.
Can I use SQLite instead of PostgreSQL?
You can – SQLite is n8n’s default – but PostgreSQL is recommended for anything beyond light testing. It handles concurrent access better and is what n8n itself runs internally.
What happens if I forget to back up and my server fails?
You lose your workflows, credentials and execution history unless you have a backup stored somewhere other than the same server. Set up the daily backup script in Step 4, and copy the backup folder off the server on a schedule – a backup that lives only on the server it protects doesn’t protect you from that server failing.
Is self-hosting n8n secure?
It can be, if you keep the server patched, use a firewall to limit open ports, keep n8n itself updated, and never expose the raw n8n port (5678) directly to the internet – the Caddy reverse-proxy setup above only exposes ports 80 and 443. n8n itself notes that self-hosting is recommended for users experienced with server management; mistakes at the infrastructure level can lead to data loss or security issues that a managed Cloud plan would prevent.
Can I move from n8n Cloud to self-hosted later, or the other way round?
Yes. Workflows can be exported as JSON from either environment and imported into the other, so you’re not locked into your first choice.
How long does this setup actually take?
For someone comfortable with a terminal, roughly 30–45 minutes from a fresh server to a working, HTTPS-secured instance, most of which is waiting for DNS to propagate and Docker to pull images.
Methodology and verification
This guide is based on our own setup of the process described above, on a Hetzner CX23 server running Ubuntu 24.04, checked against n8n’s official Docker and deployment documentation in September 2026. Server pricing was checked against Hetzner, DigitalOcean and Contabo’s published pricing in the same month; prices vary by region and can change, so confirm current figures before budgeting. Our fact-checking policy explains how we verify and date claims, and our editorial policy covers our independence.
Primary sources: n8n hosting documentation · n8n Docker install guide · n8n 3.0 breaking changes · Hetzner Cloud pricing.
Last verified: September 2026. Spotted a step that’s changed? Tell us and we’ll update it.
2 thoughts on “n8n Self-Hosting in 2026: The Complete Setup and Real Cost Guide”