Setup

How to Self-Host n8n (Docker, VPS or Free Local Setup)

How to self-host n8n: run it locally with Docker in five minutes, or on a VPS with a domain and HTTPS for production. Costs, options and the best setup tutorials.

By the n8n Academy team · Updated · 4 min read

How to Self-Host n8n (Docker, VPS or Free Local Setup)

One of n8n's biggest advantages over Zapier and Make is that you can run it yourself. The self-hosted Community Edition is free under n8n's fair-code licence, your data stays on your server, and there is no per-task bill that grows as your workflows do. The trade-off is that you are responsible for updates, backups and security.

There are three sensible ways to self-host n8n. Pick based on what you are doing.

OptionBest forCostWebhooks from the internet
Local (Docker Desktop or npm)Learning and testingFreeOnly with a tunnel (ngrok, Cloudflare)
VPS (Hostinger, DigitalOcean, Hetzner…)Real projects and clientsAbout $5 to $20/monthYes, with a domain and HTTPS
Managed n8n CloudNo server work at allPaid plans after trialYes

Option 1: Run n8n locally with Docker (5 minutes)

Install Docker Desktop, then run these two commands. The volume keeps your workflows and credentials when the container restarts.

Terminal
docker volume create n8n_data

docker run -it --rm --name n8n -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

Open http://localhost:5678, create the owner account and you are running n8n. If you have Node.js installed, npx n8n also works for a quick try, but Docker is closer to how you will run it in production.

Local webhooks

Apps on the internet cannot reach localhost. To test webhooks from Stripe, a form tool or Telegram, put a tunnel in front of n8n (ngrok or Cloudflare Tunnel) and set the WEBHOOK_URL environment variable to the tunnel address.

Recommended tutorials from the library

Option 2: Self-host n8n on a VPS (for real work)

For anything clients depend on, run n8n on a virtual private server so it is online 24/7. Several providers, including Hostinger, offer one-click n8n images that install Docker, n8n and a reverse proxy for you. The manual route is: rent a small VPS (2 GB of RAM is a comfortable start), install Docker, run n8n with Docker Compose behind a reverse proxy such as Caddy or Traefik for automatic HTTPS, and point a subdomain like n8n.yourdomain.com at it.

Settings worth getting right on day one:

  • `N8N_HOST` and `WEBHOOK_URL` set to your public domain, or webhook URLs will point to localhost.
  • `N8N_ENCRYPTION_KEY` set explicitly and backed up. Lose it and you lose access to every saved credential.
  • A persistent volume (or Postgres) for data, plus scheduled backups.
  • HTTPS only, and do not expose the editor on a raw IP address.
  • Timezone (GENERIC_TIMEZONE) set, so Schedule Triggers fire when you expect.

Recommended tutorials from the library

Keeping a self-hosted n8n healthy

  1. Back up before every update: export workflows and keep the data volume or database backed up.
  2. Update regularly. n8n releases often, and new AI nodes only arrive when you update. With Docker Compose: pull the new image, then recreate the container.
  3. Read the release notes for breaking changes before major version jumps.
  4. Monitor executions and set up an error workflow that alerts you when something fails.

Self-hosted or n8n Cloud?

Self-host when you want zero software cost, full data control or unlimited executions, and you are comfortable maintaining a server. Choose n8n Cloud when you want to spend your time on workflows, not infrastructure, or a client needs a managed service. Many builders learn on a local Docker install, run their own projects on a VPS, and put clients on whichever the client prefers. For how n8n compares with other tools, see n8n vs Zapier vs Make.

Next: build your first AI agent

All courses are included in one $12.99 payment. See every course

Frequently asked questions

Is self-hosted n8n free?

Yes. The n8n Community Edition is free to self-host under n8n's fair-code Sustainable Use License, which covers internal business use and consulting work such as building workflows for clients. Reselling n8n itself as a hosted service needs a commercial licence. Your only cost is the server, often $5 to $20 a month.

What are the minimum requirements to self-host n8n?

A small server with 1 to 2 GB of RAM and one or two CPU cores runs n8n comfortably for personal use and small clients. Heavier workloads, many concurrent executions or large files need more memory and a Postgres database instead of the default SQLite.

How do I install n8n with Docker?

Create a volume with "docker volume create n8n_data", then run the official image with port 5678 published and that volume mounted at /home/node/.n8n. Open localhost:5678 to set up the owner account. For production, use Docker Compose behind an HTTPS reverse proxy.

Why do my n8n webhooks show localhost?

n8n builds webhook URLs from its configuration. Set the WEBHOOK_URL environment variable (and N8N_HOST) to your public domain or tunnel address, then restart n8n. The Webhook node will then show URLs that external apps can reach.