Self-Hosting

How to Self-Host n8n (2026 Setup Guide)

Step-by-step 2026 guide to self-hosting n8n free with Docker or Coolify: env config, persistence, SSL, securing the editor, and backups.

MManojJuly 20, 202610 min read
Share

To self-host n8n in 2026, run the official Docker image on a Linux VPS, persist the /home/node/.n8n volume, put it behind a reverse proxy for free SSL, and lock down the editor with user management and a strong encryption key. The Community Edition is free, gives you unlimited executions, and every core node — you only pay for the server it runs on.

Short answer

Self-host n8n by deploying the official n8nio/n8n Docker container on a small Linux VPS. Mount a persistent volume for /home/node/.n8n, set N8N_ENCRYPTION_KEY, N8N_HOST, N8N_PROTOCOL=https and WEBHOOK_URL, then terminate SSL through a reverse proxy like Caddy, Traefik, or Coolify. Enable user management, use PostgreSQL for production, and schedule off-server backups.

I run open-source automation and ERPNext work at Mith Tech in Bengaluru, and n8n is the tool I reach for whenever a client wants their workflows — lead capture, invoice syncs, WhatsApp alerts — running on infrastructure they actually own. Honestly, the install is the easy hour; the part people skip is securing the editor and testing that a backup restores, and that is exactly the part that bites you six months later.

I have deployed n8n for Indian SMBs alongside their ERPNext setups often enough that the same handful of mistakes come up every time. This guide is the checklist I actually follow: install cleanly, make data survive restarts, get real SSL, secure the editor, and prove the backup works. All of it uses the free Community Edition.

Is n8n free to self-host, and what is the licence?

Yes — the n8n Community Edition is free to download and self-host, with unlimited workflows and unlimited executions. There are no per-execution or per-workflow charges on your own server; your only cost is the infrastructure. What is easy to miss is the licence model, because n8n is source-available rather than a conventional open-source project.

n8n is published under the Sustainable Use License, a "fair-code" licence. It is source-available, not OSI-certified open source. In plain terms: you may use, modify, and self-host n8n freely for your own internal business purposes, non-commercial use, or personal use. The limitations that matter are that you cannot host n8n and charge third parties to access it, and you cannot white-label it as your own commercial product. For a Bengaluru SMB automating its own sales funnels, invoicing, or customer operations, that is fully allowed.

Questionn8n Community Edition (self-hosted)
Software costFree
Execution limitsNone — unlimited
Workflow limitsNone — unlimited
Licence modelSustainable Use License (fair-code, source-available)
Your own business automationsAllowed
Reselling hosting / white-labelingNot allowed
What you actually pay forThe server, database, and your setup time

If you need something for cost comparison, note that hosted plans and enterprise features are priced separately — check n8n's official pricing page, since editions and terms change. This guide stays entirely on the free self-hosted path.

Skimmable summary: Community Edition is free with unlimited executions; the Sustainable Use License permits your own internal business automations but not reselling hosting or white-labeling.

What server do you need to self-host n8n?

A small Linux VPS is enough for most SMB workloads. A single-core, 1 GB RAM instance runs a light n8n install, but 2 CPU cores and 2 GB RAM give comfortable headroom once you add PostgreSQL and a few concurrent workflows. Pick any mainstream provider — pricing varies, so check the vendor's official page — and prefer a region close to your users for lower webhook latency.

Before you install, get three things ready:

  • A domain or subdomain (for example automation.yourcompany.in) pointed at the server's IP with an A record. n8n webhooks and OAuth callbacks need a real hostname, not an IP.
  • Open firewall ports: 22 (SSH), 80 and 443 (HTTP/HTTPS for the reverse proxy and SSL challenges). You do not expose n8n's internal port 5678 to the public directly.
  • Docker installed, or a PaaS like Coolify that manages Docker for you.

For memory-heavy automations — large data merges, PDF generation, big API payloads — size up the RAM rather than the CPU first. n8n is more memory-bound than CPU-bound in typical SMB use.

Skimmable summary: A 2 CPU / 2 GB RAM Linux VPS with a pointed domain and ports 22, 80, 443 open covers most SMB n8n workloads; size up RAM before CPU.

How do you install self-hosted n8n with Docker?

Docker is the cleanest install method because it isolates n8n and its Node runtime from the host and makes upgrades a one-line pull. The two routes I use are a Coolify one-click deploy for teams that want a dashboard, or a hand-written Docker Compose file for full control. Both run the same official n8nio/n8n image.

1

Choose Coolify or Docker Compose

If you already run Coolify, add n8n as a service and it wires the container, domain, and SSL for you — see my Coolify self-hosting guide for the base setup. If you prefer raw control, write your own Compose file as below.

2

Write the Docker Compose file

Create a docker-compose.yml that runs the official image, maps the internal port, and mounts a named volume for persistence:

services:
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:5678:5678"
    environment:
      - N8N_HOST=automation.yourcompany.in
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://automation.yourcompany.in/
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - GENERIC_TIMEZONE=Asia/Kolkata
      - N8N_SECURE_COOKIE=true
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Binding to 127.0.0.1:5678 keeps n8n reachable only from the reverse proxy, never the open internet.

3

Set a fixed encryption key

Generate a long random string and store it in a .env file next to the Compose file as N8N_ENCRYPTION_KEY=.... n8n uses this key to encrypt saved credentials. If it changes, every stored credential becomes unreadable.

4

Bring it up

Run docker compose up -d, then docker compose logs -f n8n to confirm it started clean. The editor is now live on the loopback port, ready for the proxy in the next section.

Skimmable summary: Run the official n8nio/n8n image via Coolify or a Compose file, bind it to localhost only, set a fixed encryption key, and bring it up with docker compose up -d.

How do you make n8n data survive restarts?

Persistence is the single most common thing people get wrong. n8n stores your workflows, credentials, and encryption key inside /home/node/.n8n in the container. If that directory is not mounted to a volume, everything vanishes the moment the container is recreated during an update or reboot.

Two settings guarantee your data survives:

  • Mount the data directory. The volumes block in the Compose file above maps a named Docker volume to /home/node/.n8n. This keeps workflows, execution history, and the SQLite database on disk outside the container's lifecycle.
  • Pin the encryption key. Set N8N_ENCRYPTION_KEY explicitly rather than letting n8n auto-generate one. An auto-generated key lives only inside the mounted directory, so if you ever move servers without copying that folder, your saved credentials cannot be decrypted. A fixed key you control makes migrations painless.

For anything beyond a hobby instance, switch the database from the default SQLite to PostgreSQL. SQLite is fine for testing, but under concurrent executions PostgreSQL is far more robust. Add a postgres service to your Compose file and point n8n at it with the DB_TYPE=postgresdb and DB_POSTGRESDB_* environment variables. This is the same principle behind reliable self-hosting on a cost-effective VPS — state lives in a managed, backed-up store, not inside a disposable container.

Guard the encryption key like a password

Your N8N_ENCRYPTION_KEY and the /home/node/.n8n volume together hold every credential your workflows use — API tokens, database passwords, WhatsApp keys. Store the key in a secrets manager, never commit it to Git, and include it in your backup routine. Lose it and you re-enter every credential by hand.

Skimmable summary: Mount /home/node/.n8n to a volume and set a fixed N8N_ENCRYPTION_KEY; move to PostgreSQL for production so state survives updates and server moves.

How do you add SSL and secure the n8n editor?

Never run the n8n editor on plain HTTP — it handles credentials and webhook payloads that must be encrypted in transit. The clean approach is to put a reverse proxy in front of n8n that terminates TLS with a free Let's Encrypt certificate, while n8n itself listens only on localhost. n8n's own docs recommend proxying rather than serving TLS directly from the app.

1

Put a reverse proxy in front

Use Caddy, Traefik, or Nginx (or let Coolify do it). Caddy is the least fussy: a two-line Caddyfile fetches and auto-renews a Let's Encrypt certificate for your domain and forwards traffic to 127.0.0.1:5678. Traefik does the same via labels in Docker Compose.

2

Match the n8n environment to HTTPS

Set N8N_PROTOCOL=https, N8N_HOST to your domain, and WEBHOOK_URL to the full https:// address. These make n8n generate correct HTTPS webhook and OAuth callback URLs. Keep N8N_SECURE_COOKIE=true so the session cookie is only sent over HTTPS.

3

Turn on user management

On first load, n8n prompts you to create an owner account. Set a strong password immediately and add named user accounts for your team instead of sharing one login. This gives you an audit trail and per-user access rather than an open editor.

4

Reduce the attack surface

Do not expose port 5678 publicly — only the proxy's 443 should be open. Keep the server patched, restrict SSH to keys, and consider an allowlist or VPN in front of the editor if only your office needs it. Webhook URLs can stay public while the editor stays private.

If you are weighing this whole self-hosted path against a managed automation SaaS, my n8n vs Zapier vs Make comparison for India walks through when owning the stack is worth the effort and when it is not.

Skimmable summary: Terminate SSL at a reverse proxy with free Let's Encrypt certs, set n8n's protocol/host/webhook env vars to HTTPS, enable user management, and never expose port 5678 publicly.

How do you back up a self-hosted n8n instance?

Back up two things: the database and the encryption key. Together they let you rebuild the entire instance on a new server. A backup you have never restored is a hope, not a backup — so test the restore at least once before you rely on it.

A practical routine looks like this:

  • Database dump. For PostgreSQL, run a scheduled pg_dump (or use your provider's managed snapshots). For a small SQLite instance, snapshot the whole /home/node/.n8n volume.
  • Encryption key. Store N8N_ENCRYPTION_KEY separately in a password manager or secrets vault. Without it, a restored database cannot decrypt credentials.
  • Off-server copy. Push dumps to S3-compatible object storage or another location — not the same disk. If Coolify manages your instance, its scheduled backups can send snapshots straight to an S3 bucket.
  • Export workflows as code. n8n workflows are JSON. Committing exported workflows to a Git repo gives you version history and a second recovery path independent of the database.
2
Things to back up: database + encryption key
1
Restore test before you trust it
0
Public ports beyond your reverse proxy's 443

Skimmable summary: Back up the database and the encryption key together, push copies off-server, export workflows to Git, and run one real restore test before depending on it.

Frequently asked questions

Is self-hosted n8n really free with unlimited executions?

Yes. The n8n Community Edition is free to self-host and places no cap on the number of workflows or executions you run on your own server. The only cost is the infrastructure — the VPS, database, and your setup time. Execution limits and tiered pricing apply to hosted plans, not to the self-hosted Community Edition.

What is the Sustainable Use License, and can I use n8n commercially?

The Sustainable Use License is n8n's fair-code, source-available licence. You may freely use, modify, and self-host n8n for your own internal business purposes, including commercial automations for your own company — automating your invoicing, sales, or operations is allowed. What is not allowed is hosting n8n and charging third parties to access it, or white-labeling it as your own product. For a normal SMB, self-hosting to run your own workflows is fully permitted.

Should I use SQLite or PostgreSQL for self-hosted n8n?

Use PostgreSQL for anything in production. SQLite is the default and is fine for testing or a personal instance, but under concurrent executions it becomes a bottleneck and is harder to back up reliably. PostgreSQL handles concurrency, scales better, and integrates cleanly with standard database backup tooling. Set DB_TYPE=postgresdb and the related connection variables to switch.

Do I need a domain to self-host n8n?

Practically, yes. n8n webhooks, OAuth callbacks, and SSL all depend on a stable hostname. Point a domain or subdomain at your server's IP with an A record, then set N8N_HOST and WEBHOOK_URL to that address. Running on a bare IP without HTTPS works only for local testing and should never be used for anything handling real credentials.

Can I run n8n on the same server as ERPNext?

You can, if the server has enough RAM, but I usually keep them on separate instances or at least separate containers so a heavy automation run never starves your ERP. n8n pairs beautifully with ERPNext for syncing orders, invoices, and notifications. For how the two connect, see the ERPNext platform below and my writing on wiring n8n into a Frappe stack.

How do I keep the n8n editor secure?

Run it only behind HTTPS via a reverse proxy, enable user management with strong per-user passwords, keep the internal port bound to localhost, and never expose port 5678 to the public internet. Patch the server regularly, use SSH keys, and for editor access consider a VPN or IP allowlist while leaving only your webhook URLs public.

About the author

I am Manoj, an ERPNext implementation consultant at Mith Tech, an independent open-source ERPNext and Frappe studio based in Bengaluru. I help Indian SMBs deploy and self-host their own automation and ERP stacks — including n8n, Coolify, and ERPNext — on infrastructure they control, so they own their data and their workflows instead of renting them.

Want n8n self-hosted and wired into your ERPNext the right way?

We deploy, secure, and maintain self-hosted n8n on the Frappe/ERPNext platform for SMBs across India — or explore our n8n implementation service to see how we connect your automations to the tools you already run.

Free · By email

Get practical ERPNext & automation guides

New implementation guides, cost breakdowns and open-source tips for Indian businesses — occasionally, straight to your inbox. No spam.

M

Written by

Manoj

Founder of Mith Tech, an open-source ERP & automation studio. Hands-on ERPNext/Frappe implementation across multi-branch, multi-warehouse Indian operations — GST/TDS/PT compliance, branch-level permissions, and custom Frappe apps that give management real-time visibility.

Keep reading

See what this looks like for your business

Book a free 30-minute audit. We'll map your workflows, find where time and money leak, and design an open-source stack you actually own — no per-user licence fees.

Book a consultation
0 0
Published on 20 July 2026

Manoj

Comments

No comments yet. Start a new discussion.

Ctrl+Enter to add comment