Skip to content
Extra 20% off HostingerWEBHOST2026Get my link →
DiscountOffer.Store
Tutorials

Self-host n8n on a Hostinger VPS (Docker, HTTPS, backups)

9 min read

Run your own n8n automation server for a flat monthly price: the one-click template, or a Docker Compose setup with automatic HTTPS, plus updates, backups and which KVM plan to pick.

Why self-host n8n

n8n is a workflow automation tool, in the same space as Zapier and Make. You connect apps, add logic, and let it run. The hosted version charges by workflow executions; self-hosted, you pay for the server and run as many executions as it can handle.

n8n is distributed under its Sustainable Use License, which allows self-hosting for your own and your company's internal use. If you plan to resell n8n as a service, read the licence first.

Which plan you need

n8n itself is light, but workflows that process files, call AI models or loop over large lists use memory quickly.

PlanGood for
KVM 1 (1 vCPU, 4 GB)Personal automations and a small team's workflows on the default SQLite database
KVM 2 (2 vCPU, 8 GB)Many active workflows, Postgres alongside n8n, heavier file or AI processing
KVM 4 and upQueue mode with Redis and multiple workers

Option A — The one-click n8n template

Hostinger offers n8n as a VPS OS template. Choose it when you create the server (or reinstall an existing one from the VPS settings) and you get n8n running in Docker without touching the command line.

It's the fastest route and fine for most people. Choose Option B if you want to see every moving part, run n8n next to other apps, or control exactly which version you're on.

Option B — Docker Compose with automatic HTTPS

Start from a plain Ubuntu 24.04 server that you've already secured, with an A record for a subdomain such as `n8n.example.com` pointing at it. Caddy handles HTTPS: it requests and renews the Let's Encrypt certificate on its own.

Install Docker and create the project folder:
bash
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER   # log out and back in after this

mkdir -p ~/n8n && cd ~/n8n
openssl rand -hex 32   # copy this; it becomes N8N_ENCRYPTION_KEY
~/n8n/.env
bash
DOMAIN=n8n.example.com
N8N_ENCRYPTION_KEY=paste-the-random-string-here
GENERIC_TIMEZONE=Asia/Karachi
~/n8n/compose.yaml
yaml
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    restart: unless-stopped
    environment:
      - N8N_HOST=${DOMAIN}
      - N8N_PROTOCOL=https
      - N8N_PORT=5678
      - WEBHOOK_URL=https://${DOMAIN}/
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - TZ=${GENERIC_TIMEZONE}
    volumes:
      - n8n_data:/home/node/.n8n

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    environment:
      - DOMAIN=${DOMAIN}
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data

volumes:
  n8n_data:
  caddy_data:
~/n8n/Caddyfile
text
{$DOMAIN} {
    reverse_proxy n8n:5678
}
Start it and watch the logs:
bash
docker compose up -d
docker compose logs -f

First login and the encryption key

Open `https://n8n.example.com` and create the owner account. Do it straight away: until an owner exists, whoever reaches the URL first can claim the instance.

n8n encrypts every saved credential with `N8N_ENCRYPTION_KEY`. Keep a copy somewhere safe, outside the server. If you lose it, restored backups can't decrypt your API keys and passwords, and every credential has to be re-entered.

Updating n8n

n8n releases often. Read the release notes for breaking changes, take a backup, then pull and restart. Pin a specific version tag instead of `latest` if you'd rather update deliberately.

bash
cd ~/n8n
docker compose pull
docker compose up -d
docker image prune -f

Backups

Everything n8n stores (workflows, credentials, execution history in SQLite) lives in the `n8n_data` volume. Archive it on a schedule and copy the file off the server.

Archive the volume to the current folder:
bash
docker run --rm \
  -v n8n_n8n_data:/data:ro \
  -v "$PWD":/backup \
  alpine tar czf /backup/n8n-$(date +%F).tar.gz -C /data .
Or export workflows as JSON, which is handy for Git:
bash
docker compose exec n8n n8n export:workflow --all --output=/home/node/.n8n/workflows.json
Extra 20% off with WEBHOST2026Claim 20% off →

Frequently asked questions

Is self-hosted n8n free?

The Community Edition is free to self-host for internal use under n8n's Sustainable Use License. You pay only for the server. Some enterprise features need a paid licence.

Can n8n run on KVM 1?

Yes. For personal and small-team automations, KVM 1's 4 GB of RAM is plenty. Move to KVM 2 when you add Postgres or run heavy file or AI workflows.

Why do my webhooks show localhost URLs?

WEBHOOK_URL isn't set, or n8n was started before you set it. Set it to your public https URL with a trailing slash and recreate the container with `docker compose up -d`.

Does the WEBHOST2026 coupon work on the VPS?

Yes. The links on this site apply WEBHOST2026 to VPS plans, and the 24 and 48-month terms have the lowest monthly price.

Ready to save an extra 20% with coupon WEBHOST2026?

Get my discount link →

Disclosure: links to Hostinger on this page are referral links. If you buy through them we may earn a commission, at no extra cost to you. It doesn't change what we recommend. About us

Ready to claim your Hostinger discount?

Generate your personalised cart link with coupon WEBHOST2026 attached — it takes 20 seconds.