Truobox
Portal
VPS 5 min read

How to Self-Host n8n on a VPS with Docker and HTTPS

Truobox

Truobox

December 1, 2026

Why self-host n8n

n8n is a workflow automation tool: you connect apps and APIs in a visual editor so repetitive tasks run on their own. You can use it on n8n Cloud or run it yourself.

This guide shows how to self-host n8n on a VPS. The reasons people do it are usually these:

  • No fee per execution. The Community edition does not charge per execution or per active workflow. You pay for the server, whatever your workflows do.
  • Your data stays with you. Workflows, credentials and execution history live on your server.
  • Full control. You choose when to update, which environment variables to set and what else runs next to it.

The trade-off is that updates and backups are yours to handle. With Docker both take one command.

What you need

  • A VPS with Ubuntu 24.04 (or Debian 12) and root access.
  • At least 1 GB of RAM and 10 GB of free disk. For workflows with a lot of data or parallel executions, 2 to 4 GB is better.
  • Ports 80 and 443 open.
  • A domain or subdomain with an A record pointing to the VPS IP. Webhooks from most services only work over HTTPS, so do not skip this.

Running n8n on your laptop is fine for testing. For real use it has to be online all day and reachable from the internet, which is what a VPS gives you.

Option 1: a VPS with n8n pre-installed

The short path. When you order n8n VPS hosting at Truobox, you pick the n8n app in the cart and the server is created with everything in place:

  • Docker and Docker Compose.
  • The official n8n image.
  • Caddy as a reverse proxy that gets and renews the HTTPS certificate.
  • The webhook URL set to your HTTPS domain.

Open the address in your browser, create the owner account and build your first workflow.

n8n VPS hosting, ready in one click. Pick a plan, select n8n in the cart and skip the setup. See n8n VPS hosting →

Option 2: install n8n with one command

If you already have a VPS running Ubuntu or Debian, the same recipe is published as an open installer. Log in over SSH as root and run:

curl -fsSL https://raw.githubusercontent.com/truobox/vps-apps/main/install.sh | sudo DOMAIN=n8n.yourdomain.com bash -s -- n8n

Replace n8n.yourdomain.com with your domain. Without one, the installer falls back to an address like <your-ip>.sslip.io and HTTPS still works. It is good practice to download the script and read it before you run it.

What the installer sets up

Everything lives in /opt/n8n: a docker-compose.yml, a .env file and a Caddyfile. The Compose file runs two services:

services:
  caddy:
    image: caddy:2
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
  n8n:
    image: n8nio/n8n:latest
    environment:
      - N8N_HOST=${DOMAIN}
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://${DOMAIN}/
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
    volumes:
      - n8n_data:/home/node/.n8n

That is a shortened view; the full file is in the installer. The parts that matter:

  • Caddy terminates HTTPS and forwards traffic to n8n on port 5678. Certificates are issued and renewed automatically.
  • WEBHOOK_URL tells n8n which public address to hand out for webhooks. If it is wrong, external services call an address that does not exist.
  • N8N_ENCRYPTION_KEY is generated on your server during the install. n8n uses it to encrypt the credentials you save.
  • n8n_data is the Docker volume that holds your workflows, credentials and settings.

After the install

Create the owner account

Open https://your-domain and n8n asks you to create the owner account. Do it right away: until then the instance is open to whoever reaches it first.

Back up the encryption key

Keep a copy of /opt/n8n/.env somewhere outside the server. Without N8N_ENCRYPTION_KEY, the credentials n8n saved cannot be read, even if you still have the data volume.

Change the domain

Create an A record for the new name and run:

truobox-domain n8n.yourdomain.com

Update n8n

cd /opt/n8n && docker compose pull && docker compose up -d

Your workflows stay in the volume, so nothing is lost when the container is replaced.

Check the logs

cd /opt/n8n && docker compose logs -f n8n

Frequently asked questions

Is self-hosted n8n free?

The Community edition can be installed without paying a license and has no fee per execution. Its license allows you to use it for your own company’s processes; the exact terms and the features that need a paid license are on the official n8n site. Your cost is the server.

How much RAM does n8n need?

It starts with 1 GB. For workflows with a lot of data or parallel executions, 2 to 4 GB is better.

Do webhooks work on self-hosted n8n?

Yes, as long as n8n has an HTTPS domain and WEBHOOK_URL points to it. That is what Telegram, WhatsApp, Stripe and most services require. The install in this guide sets it from the start.

Can I run other apps on the same VPS?

Yes. n8n runs in containers, so you can add others next to it as long as the server’s RAM and disk allow it.

Wrapping up

Self-hosting n8n comes down to a VPS, Docker, a reverse proxy with HTTPS and two things to remember: back up the encryption key and update from time to time.

If you would rather skip the setup, n8n VPS hosting at Truobox delivers the server with n8n installed and HTTPS active. To compare every plan, see the cheap VPS page.