Quick Takeaway
To self-host n8n, rent a Linux server, point a subdomain at it, install Docker and Docker Compose, then run n8n’s official Compose setup, which adds Traefik for free HTTPS certificates. Start it with “docker compose up -d” and open your subdomain. n8n itself recommends self-hosting only if you are comfortable managing servers.
Key takeaways
- n8n recommends Docker Compose for self-hosting; its plain “docker run” page is marked outdated.
- The official setup uses Traefik to get HTTPS certificates automatically, and n8n is only reachable over HTTPS.
- Everything important lives in the n8n_data volume: the SQLite database and the encryption key for your saved credentials. Back it up.
- Updating is three commands: docker compose pull, docker compose down, docker compose up -d.
- n8n’s own docs say self-hosting is for experienced users; if nobody on your team manages servers, n8n Cloud is the safer choice.
Self-hosting n8n is attractive for two reasons: the Community edition is free for your own internal business use, and your workflows and data stay on a server you control. The catch is that you also become the person responsible for that server. This guide walks through the setup n8n’s documentation recommends, checked in November 2026, and is honest about the work that comes after the install.
If you are still deciding between n8n Cloud and self-hosting, read our n8n pricing guide first. It compares the plans with what a self-hosted server really costs you in time.
- Self-hosted n8n
- Self-hosted n8n means running the n8n software on a server you rent or own, instead of using n8n Cloud. You get full control over data and configuration, and you take on installation, security, backups and updates yourself.
Should you self-host n8n at all?
n8n is direct about this. Its hosting docs say: “n8n recommends self-hosting for expert users. Mistakes can lead to data loss, security issues, and downtime.” The skills it lists are setting up servers and containers, managing resources and scaling, securing servers and applications, and configuring n8n. If those are not in your team, the docs recommend n8n Cloud.
| Aspect | Self-hosted (Community edition) | n8n Cloud |
|---|---|---|
| Software cost | Free for your own internal business use | Monthly plan |
| Server | You rent and manage it | Included |
| HTTPS, updates, backups | Your job | Handled by n8n |
| Where data lives | On your server | On n8n’s infrastructure |
| Best for | Teams with someone who manages servers, or strict data rules | Teams that want to build workflows, not run servers |
Free means “for your own business”
The Community edition uses n8n’s Sustainable Use License, which covers your own internal business use. Reselling n8n or letting your customers build workflows in your instance needs a separate agreement. Our pricing guide explains the license in more detail.
What do you need before you start?
- A Linux server (a small cloud VPS is enough to start) with SSH access.
- A domain you control, so you can create a subdomain such as n8n.yourcompany.com.
- Docker and Docker Compose installed. Check with “docker --version” and “docker compose version”.
- An email address for your HTTPS certificate notices.
- About an hour, plus a plan for who will update and back up the server every month.
How do you install n8n with Docker Compose?
These are the steps from n8n’s “Use Docker Compose” page. The Compose file itself is long and changes between releases, so copy it from the official page rather than from a blog post (including this one).
Step 1: Point a subdomain at your server
In your DNS settings, add an A record named “n8n” (or the subdomain you prefer) that points to your server’s IP address.
Step 2: Create a project folder
On the server, run “mkdir n8n-compose” and “cd n8n-compose”, then create a folder for files n8n may read or write with “mkdir local-files”.
Step 3: Create the .env file
This file holds your settings. The official example uses four values: DOMAIN_NAME, SUBDOMAIN, GENERIC_TIMEZONE and SSL_EMAIL (shown below).
Step 4: Create compose.yaml
Copy the Compose file from n8n’s docs. It runs two services: Traefik, which handles HTTPS certificates and routing, and n8n itself, which only listens on the server’s own localhost so the outside world reaches it through Traefik.
Step 5: Start n8n
Run “sudo docker compose up -d”. To stop it later, run “sudo docker compose stop”.
Step 6: Open your subdomain
Visit https://n8n.yourcompany.com and create the owner account. n8n is only reachable over HTTPS in this setup; if the page does not load, check your firewall and DNS record first.
DOMAIN_NAME=yourcompany.com
SUBDOMAIN=n8n
GENERIC_TIMEZONE=America/New_York
SSL_EMAIL=you@yourcompany.comThe timezone matters more than it looks: scheduled workflows run on it. n8n’s docs note that New York is the default if you do not set it.
Testing on your own computer first?
n8n’s docs also describe a single-container quick start with “docker run” on port 5678 (http://localhost:5678). It is fine for trying n8n out, but the docs mark that page as outdated and recommend Docker Compose for real use.
What is the n8n encryption key, and why does it matter?
When you save a credential in n8n, such as a Google login or an API key, n8n encrypts it in the database. By default n8n generates a random key on first launch and stores it in its data folder; you can also set your own with the N8N_ENCRYPTION_KEY environment variable.
In the Compose setup, the n8n_data volume holds both the SQLite database and that key. Treat the volume as one unit: back up the database and the key together, and keep a copy of the key somewhere safe outside the server. n8n’s docs also warn that rotating the key is a one-way change, so take a full database backup before you ever do it.
Which database should you use?
n8n uses SQLite by default, which needs no setup and works for small teams. PostgreSQL is the other supported option (set DB_TYPE=postgresdb plus the DB_POSTGRESDB_* connection variables); MySQL and MariaDB were deprecated in n8n 1.0. If you ever need queue mode for heavy workloads, you will need PostgreSQL, because n8n says queue mode with SQLite is not supported for a distributed setup.
How do you update self-hosted n8n?
n8n releases updates often, and updates include security fixes. With Docker Compose, the docs give three commands, run from the folder that holds your compose.yaml:
docker compose pull
docker compose down
docker compose up -dBack up the n8n_data volume before each update, read the release notes for breaking changes, and update on a schedule (monthly is a sensible minimum) rather than whenever someone remembers.
How do you keep a self-hosted n8n secure?
- Keep the official setup’s design: n8n listens only on localhost and the public reaches it through Traefik over HTTPS.
- Allow only the ports you need (SSH, 80 and 443) in the server firewall, and use SSH keys instead of passwords.
- Use a strong owner password and limit who has accounts.
- Give each workflow credential only the access it needs, and authenticate your webhooks.
- Apply n8n and operating system updates every month.
- Back up the data volume automatically and test a restore at least once.
You can check the public side of your setup (HTTPS, certificate expiry and security headers) with our free website security checker.
When do you need queue mode?
Most small businesses never do. n8n’s scaling docs describe queue mode for running at scale, with many users, workflows or executions: a main instance hands work to separate worker processes through Redis, with PostgreSQL as the database. If one server handles your workload comfortably, keep the simple setup.
Self-hosting n8n: common questions
Is self-hosted n8n free?
The Community edition software is free for your own internal business use. You still pay for the server and spend time on updates, security and backups, and you get no official support.
Can I self-host n8n on Windows?
n8n’s one-line installer requires Docker on Linux or macOS, or WSL on Windows. For a business setup, a Linux server is the usual choice.
What port does n8n use?
n8n listens on port 5678. In the official Docker Compose setup that port is only open on the server’s localhost, and visitors reach n8n over HTTPS through Traefik on ports 80 and 443.
Does self-hosted n8n need PostgreSQL?
No. SQLite is the default and needs no setup. PostgreSQL is the supported alternative, and you need it if you move to queue mode.
How do I back up self-hosted n8n?
Back up the n8n_data volume, which holds the SQLite database and the encryption key, on a schedule, and store a copy of the encryption key safely outside the server. If you use PostgreSQL, back up the database as well.
Can WikiAI set up and maintain self-hosted n8n for us?
Yes. We set up self-hosted n8n with HTTPS, backups and a monthly update routine as part of our n8n automation service, or recommend n8n Cloud if that suits your team better.