Self-Hosting7 min readUpdated November 23, 2026

How Do You Self-Host n8n on a VPS?

We run n8n on our own Hetzner box in production. It replaced Zapier. Here is the setup, the backups, and the parts nobody warns you about.

Self-hosting n8n means running it in Docker behind a reverse proxy with Postgres, not SQLite, and a backup job you have actually restored. The install takes an afternoon. The real work is the database, queue mode when volume grows, and the backups you test before you need them.

You self-host n8n by running it in Docker next to a Postgres database and putting a reverse proxy in front of it. The whole stack is a docker compose file with three services: n8n, Postgres, and a proxy like Caddy or Traefik that handles TLS.

How do you self-host n8n on a VPS?

You self-host n8n by running it in Docker next to a Postgres database and putting a reverse proxy in front of it. The whole stack is a docker compose file with three services: n8n, Postgres, and a proxy like Caddy or Traefik that handles TLS.
We run this on a Hetzner VPS. The n8n container reads its config from environment variables: the database connection, the encryption key, the webhook URL, and the host. The encryption key is the important one. It encrypts every credential you store in a node, so it has to be stable and backed up. Start with Postgres, not the default SQLite. SQLite is fine for a first look and a dead end once you have real volume or more than one worker. Postgres is the supported production path and it is what the backup story assumes.

What breaks when you self-host n8n?

The first thing that breaks is disk. n8n writes execution data for every run, and a busy workflow can fill a small VPS in weeks. Set the execution data pruning options and watch the disk with an alert. A full disk stops the database and takes the whole stack down.
The second is memory. When many workflows run at once, the single n8n process competes for RAM. The fix is queue mode: a main process for the UI and webhooks, and worker processes for execution, with Redis as the queue. We moved to queue mode after a batch of webhooks timed out under load. The third is the webhook URL. If you move the instance or change the domain, the webhook URL has to match or every incoming trigger 404s. Set it explicitly in the environment and test a webhook after any move. The fourth is upgrades. Read the changelog before you bump the image, because a node can change behavior between versions.

How do you back up a self-hosted n8n?

Back up two things: the Postgres database and the encryption key. The database holds your workflows, credentials, and execution history. The encryption key decrypts the credentials. A database backup without the key restores a pile of unreadable secrets.
Run pg_dump on a schedule and ship the dump off the server, to object storage or another host. Keep the encryption key in your secrets manager, not only in the compose file. If the VPS dies, you need both to rebuild. The part most people skip is the restore test. Spin up a throwaway container, restore the dump, point n8n at it with the same key, and confirm the workflows load and a credential decrypts. Do this once a quarter. A backup you have never restored is a hope, not a backup.

Is self-hosting n8n worth it?

Self-hosting n8n is worth it when you run real volume or your workflows touch data you cannot send to a third party. The software is free, the VPS is cheap, and you keep the data on your own box. For a team already comfortable with Docker, the maintenance is a few hours a month.
It is not worth it if you have no one to own the server. A self-hosted instance needs someone to watch disk, apply updates, and test backups. If that person does not exist, a managed tool is cheaper than an outage. We replaced Zapier with self-hosted n8n and the cost dropped from a monthly subscription to a single VPS. The trade was maintenance, and we were already running servers. That is the honest calculation: control and cost against the work of owning a box.

4 Tips to Get Started

1

Use Postgres from day one, not the default SQLite. SQLite is fine for a demo and a dead end for anything with real volume.

2

Set the encryption key and the webhook URL as environment variables and back them up. Lose the encryption key and every stored credential is gone.

3

Put n8n behind a reverse proxy with TLS. Never expose port 5678 to the internet directly.

4

Run the backup job on a schedule and restore it into a throwaway container once a quarter. An untested backup is a hope.

Ready to Stop Worrying About Infra?

Knowledge is the first step. Get a free 1-hour diagnostic and see where your infrastructure leaks time, money, and focus.

Sources & References

roqy.io cites authoritative sources including engineering blogs, vendor documentation, industry surveys, and academic research to ensure accuracy.

R

Ron Cohen — Founder & DevOps Engineer

Content reviewed by the roqy.io team. Our guides are based on publicly available data and cited sources above.

Disclaimer: This content is for informational and educational purposes only. It does not constitute professional advice or a guarantee of specific results. Infrastructure needs vary by team, stack, and stage. Consult a qualified engineer for advice tailored to your situation.

Frequently Asked Questions

How do I self-host n8n on a VPS?

Run n8n in Docker with a Postgres database, put it behind a reverse proxy with TLS, and set the encryption key and webhook URL as environment variables. A docker compose file with n8n and Postgres is enough to start. Add queue mode with Redis when your workflow volume grows.

Is self-hosting n8n free?

The software is free under the fair-code license. You pay for the VPS, usually $5-20 a month, and your own time for setup and maintenance. Compared to a Zapier plan at $20-100 a month, the box pays for itself quickly if you run real volume.

What breaks when you self-host n8n?

The common failures are a full disk from execution logs, a webhook URL that points at the wrong host after a move, memory pressure when many workflows run at once, and an upgrade that changes a node. None are fatal if you watch disk, memory, and the changelog.

How do I back up a self-hosted n8n?

Back up two things: the Postgres database with pg_dump and the encryption key from your environment. The database holds the workflows and credentials, and the key decrypts the credentials. Back up both, store them off the server, and test a restore.

Get the DevOps Ecosystem Behind You

One accountable engineer. Full platform behind him. Month-to-month, no lock-in.