# Self-host n8n

> Workflow automation platform with a visual canvas, custom code steps and integrations with other services, run self-hosted or in the cloud. Run your own n8n on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.

_Updated November 23, 2026_

Running your own n8n usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make n8n behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.

## Just ask your agent

Open a Plus workspace (n8n runs in Docker, which Plus and Pro include), tap **Launch** to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:

```text
Set up n8n on this workspace and give me the link. Follow https://envhaven.com/self-host/n8n.md
```

Then open the link it sends and create your n8n account straight away, before anyone else finds the address. That is the whole request: the address in it is this page's Markdown copy, and the agent follows the instructions for it further down, with every setting n8n's docs require.

## Or keep it private with Tailscale

The preview URL puts n8n on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives n8n an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace's **Vars** pane as `TS_AUTHKEY`, and ask the agent:

```text
Set up n8n on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/n8n.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
```

- A Tailscale container runs beside n8n, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. [Keep self-hosted apps private with Tailscale](https://envhaven.com/guides/self-host-privately-with-tailscale) covers both, and what Tailscale's free plan includes.

| At a glance |  |
| --- | --- |
| What it is | Automation and workflows |
| License | Sustainable Use License 1.0 |
| Runs as | Docker (`docker.n8n.io/n8nio/n8n`) or a native install |
| Memory | 4 GB (stated for the Compose guide that includes the n8n Assistant sandbox); no minimum or recommendation documented for n8n alone ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/install-using-docker-compose.md)) |
| Plan that fits | Plus or larger |
| Web port | 5678 |
| Documentation | [docs.n8n.io/deploy/host-n8n/](https://docs.n8n.io/deploy/host-n8n/) |

## What your agent takes care of

- **Installing it.** n8n runs from the official image, `docker.n8n.io/n8nio/n8n`, with its data in folders under `~/apps/n8n`.
- **Putting it on an HTTPS address.** The workspace's preview URL serves it, and your own domain can too.
- **Locking it down first.** What n8n's docs say to set before it faces the internet, below.
- **Telling you what to back up**: ~/.n8n (Docker: n8n_data volume mounted at /home/node/.n8n) and PostgreSQL database, if used instead of the default SQLite ([docs](https://docs.n8n.io/deploy/host-n8n/keep-n8n-running/backup-and-restore.md)).

### The settings it needs behind a proxy

- `N8N_WEBHOOK_URL`: Public base URL n8n shows and registers for webhooks when it runs behind a reverse proxy. Available from n8n 2.30.0; WEBHOOK_URL is the deprecated alias. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/configure-webhook-urls-with-reverse-proxy.md))
- `N8N_PROXY_HOPS`: Number of reverse proxies in front of n8n (default 0). Set to 1 behind one proxy, which also needs to send the X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto headers. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/configure-webhook-urls-with-reverse-proxy.md))
- `N8N_EDITOR_BASE_URL`: Public URL of the editor; also used in emails n8n sends and as the redirect URL for SAML sign-in. Takes a full URL such as https://n8n.example.com/. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md))
- `N8N_HOST`: Host name n8n runs on (default localhost). The docs say it takes the bare hostname, for example n8n.example.com. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md))
- `N8N_PROTOCOL`: Protocol used to reach n8n, http or https (default http); n8n combines it with N8N_HOST and N8N_PORT to build webhook URLs unless N8N_WEBHOOK_URL is set. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md))
- `N8N_SECURE_COOKIE`: Sends cookies over HTTPS only; defaults to true. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/security.md))
- `N8N_PUSH_BACKEND`: Chooses WebSockets (default) or server-sent events for pushing changes to the editor UI. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md))

### Before it faces the internet

- The first in-app setup creates the owner account. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/user-management.md))
- Do not expose n8n directly to the internet; put a reverse proxy or load balancer in front. ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md))
- Set a stored, stable encryption key (the checklist suggests openssl rand -hex 32); without it a restored database cannot be decrypted. ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md))

## Things to ask next

Everything after the install is one more sentence to the agent. Some that come up:

- "Build a workflow that posts each new GitHub issue in my repo to Slack."
- "Add the credentials it needs from my Vars pane, and test the workflow once."
- "Move n8n to app.example.com." Add the domain on the dashboard's Domains page with a CNAME to `domains.envhaven.app`, and the agent changes n8n's address settings to match.
- "Update n8n to the latest release." It pulls the new image and recreates the container, data kept.

## Instructions for the agent

The agent reads these from the page's Markdown copy. They also work pasted on their own, if you would rather give them in your own words.

```text
Set up n8n on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, docker.n8n.io/n8nio/n8n, starting from the docs' compose file: https://github.com/n8n-io/n8n/blob/master/docker/get-n8n-compose.yml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- Keep the compose file in ~/apps/n8n and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to n8n's port 5678.
- The preview URL terminates HTTPS in front of n8n: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/n8n.md for the preview URL, as n8n's docs describe for running behind a proxy; skip any that apply only when n8n serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/n8n.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set n8n up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
```

## What to know

- In Docker, n8n's containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- The install without Docker: npm (deprecated: the docs say n8n 3.0 and later is distributed through Docker only) ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/install-with-npm.md))
- Request payloads are capped at 16 MiB by default; raising N8N_PAYLOAD_SIZE_MAX needs more memory and CPU. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/endpoints.md))
- The Compose guide's stack includes a privileged Docker-in-Docker sandbox runner for n8n Assistant, needs 4 GB RAM and 2 vCPUs, and the docs call the isolation weak. ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/install-using-docker-compose.md))
- SMTP is optional, but without it users cannot reset passwords. ([docs](https://docs.n8n.io/deploy/host-n8n/configure-n8n/user-management.md))
- Services that call webhooks need to reach the webhook URL over the internet. ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md))
- SQLite is not supported in queue mode and is not recommended for multi-user production use. ([docs](https://docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md))
- n8n expects its own host rather than a path under one, so it takes the workspace's preview URL or a domain of its own.
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.

## Without a workspace

The manual route, on a server you run:

1. Rent a Linux VPS, secure SSH, and create a user for the app.
2. Install Docker and write a compose file from the official image.
3. Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
4. Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
5. Keep the firewall closed except for the proxy, and schedule backups and updates.

n8n's own [documentation](https://docs.n8n.io/deploy/host-n8n/) covers each step for its install methods.

## Sources

Facts about n8n come from its own documentation, checked on 2026-11-23:

- [docs.n8n.io/deploy/host-n8n](https://docs.n8n.io/deploy/host-n8n/)
- [github.com/n8n-io/n8n/blob/master/README.md](https://github.com/n8n-io/n8n/blob/master/README.md)
- [docs.n8n.io/deploy/host-n8n/install-options/install-with-npm.md](https://docs.n8n.io/deploy/host-n8n/install-options/install-with-npm.md)
- [docs.n8n.io/deploy/host-n8n/install-options/install-using-docker-compose.md](https://docs.n8n.io/deploy/host-n8n/install-options/install-using-docker-compose.md)
- [docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/configure-webhook-urls-with-reverse-proxy.md](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/configuration-examples/configure-webhook-urls-with-reverse-proxy.md)
- [docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/deployment.md)
- [docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/security.md](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/security.md)
- [docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/endpoints.md](https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/endpoints.md)
- [docs.n8n.io/deploy/host-n8n/configure-n8n/user-management.md](https://docs.n8n.io/deploy/host-n8n/configure-n8n/user-management.md)
- [docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md](https://docs.n8n.io/deploy/host-n8n/install-options/production-requirements.md)
- [docs.n8n.io/deploy/host-n8n/keep-n8n-running/backup-and-restore.md](https://docs.n8n.io/deploy/host-n8n/keep-n8n-running/backup-and-restore.md)

## Keep reading

- [Self-host any app with your agent](https://envhaven.com/self-host)
- [Self-host Node-RED](https://envhaven.com/self-host/node-red)
- [Self-host Activepieces](https://envhaven.com/self-host/activepieces)
- [Self-host Windmill](https://envhaven.com/self-host/windmill)
- [Self-host Huginn](https://envhaven.com/self-host/huginn)
- [AI agent hosting](https://envhaven.com/guides/ai-agent-hosting)

Source: https://envhaven.com/self-host/n8n
