Talk to the NOC, IST hours — +91 75994 50220 support@bigdomainhost.com
Guide

How to self-host n8n on a VPS in India

n8n's Community edition is free to self-host, but webhooks, HTTPS and the encryption key are where most installs go wrong. This guide sets up n8n with Docker Compose and Caddy on a Linux VPS, then covers sizing, backups, updates and queue mode.

Short answer: n8n self-hosted means running the official n8nio/n8n Docker image on your own Linux VPS. Keep n8n on port 5678 inside Docker, put Caddy or Nginx in front for HTTPS, and store /home/node/.n8n in a volume. Set N8N_WEBHOOK_URL to your public https address, GENERIC_TIMEZONE and TZ to Asia/Kolkata, and a fixed N8N_ENCRYPTION_KEY, because without that key saved credentials cannot be decrypted. Start on SQLite for small use and Postgres for production.

Self-hosting n8n in short

To self-host n8n, run the official Docker image on a Linux VPS, put a reverse proxy such as Caddy in front of it for HTTPS, and keep the /home/node/.n8n folder in a persistent volume. Set your public webhook URL, the Asia/Kolkata timezone and a fixed encryption key before the first start. The free Community edition then runs with almost the full feature set.

Before you start, read the licence. Self-hosted n8n uses the Sustainable Use License, which n8n describes as fair-code. It is source-available, not an OSI-approved open source licence. You may use it to run your own business, for personal projects, and to build and maintain automations for clients on your instance. You may not host n8n as a service where your customers build or edit their own workflows, or white-label it. n8n's licence FAQ, linked under Sources, gives more examples.

What you need: VPS size, disk and database

n8n's production requirements recommend a 64-bit Linux host and Docker Engine with the Compose v2 plugin. Docker needs a real kernel, so use a KVM VPS rather than a container-based one.

RAM and vCPU

n8n does not publish one minimum for a plain instance, because memory use depends on your workflows. Its memory guide lists what pushes usage up: large JSON payloads, binary files, many nodes, the Code node, manual test runs (n8n keeps a copy of the data for the editor), and several workflows running at once. The firmest figure in the docs is in n8n's Docker Compose install guide, which asks for at least 4 GB of RAM and 2 vCPUs for the stack that includes the n8n Assistant code sandbox. n8n's Hetzner guide says a small plan is enough for most usage levels without Assistant.

A practical approach: start on 2 vCPU and 4 GB RAM, watch real usage with docker stats for a week, and resize if memory stays high. Our guide on how much RAM a VPS needs explains how to read those numbers.

Disk

Workflows themselves are small. Execution history and binary data are what grow. By default n8n prunes execution data older than 336 hours (14 days) and keeps at most 10,000 executions, controlled by EXECUTIONS_DATA_MAX_AGE and EXECUTIONS_DATA_PRUNE_MAX_COUNT. Lower them if you process files.

SQLite or Postgres

SQLite (default)PostgreSQL
SetupNothing to install, one file in .n8nSeparate service, user and backups
n8n's adviceFine for testing and small setupsRecommended for production
Queue modeNot supportedRequired
Supported versionsBundled16, 17 and 18 (n8n docs, as of July 2026; the range shifts each year)
BackupCopy the .n8n volume with n8n stoppedpg_dump plus the .n8n volume

A single person or small team automating their own work can start on SQLite. If several people build workflows, or workflows run around the clock, start on Postgres, because moving later is a migration, not a switch.

Prepare the VPS and point a subdomain

  1. Do the usual first-boot work: updates, a sudo user, SSH keys. Our Ubuntu VPS initial setup guide covers it for Ubuntu 24.04.
  2. Install Docker Engine and the Compose plugin from Docker's own apt repository, as described in how to install Docker on Ubuntu. Check with docker compose version.
  3. Create an A record such as n8n.example.com pointing to the server's IP. See pointing a domain to a VPS if you have not done this before.
  4. Open only SSH, HTTP and HTTPS in the firewall:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Port 80 must be reachable so the proxy can get a Let's Encrypt certificate. Port 5678 stays closed. Note that Docker's documentation says Docker and ufw are not compatible: a port you publish with Docker skips ufw rules. The setup below therefore does not publish 5678 at all. Only the proxy talks to n8n, over Docker's internal network.

Install n8n with Docker Compose and Caddy

n8n's own examples use Traefik. Caddy is shorter to configure and also gets and renews Let's Encrypt certificates on its own. Create a project folder and a config folder:

mkdir -p ~/n8n/conf && cd ~/n8n

Create .env with your domain, then add a random encryption key and lock the file down:

echo "N8N_DOMAIN=n8n.example.com" > .env
echo "N8N_ENCRYPTION_KEY=$(openssl rand -hex 32)" >> .env
chmod 600 .env

Create compose.yaml:

services:
  n8n:
    image: n8nio/n8n:2.48.7
    restart: unless-stopped
    environment:
      - N8N_HOST=${N8N_DOMAIN}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - N8N_WEBHOOK_URL=https://${N8N_DOMAIN}/
      - N8N_PROXY_HOPS=1
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
      - GENERIC_TIMEZONE=Asia/Kolkata
      - TZ=Asia/Kolkata
    volumes:
      - n8n_data:/home/node/.n8n

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf:/etc/caddy
      - caddy_data:/data
      - caddy_config:/config
    depends_on:
      - n8n

volumes:
  n8n_data:
  caddy_data:
  caddy_config:

Create conf/Caddyfile:

n8n.example.com {
    reverse_proxy n8n:5678
}

Start the stack and follow the logs:

docker compose up -d
docker compose logs -f

Open https://n8n.example.com and create the owner account straight away, because until you do, anyone who finds the URL can claim it. The Caddy image documentation recommends mounting the conf folder rather than the single Caddyfile, so edits are picked up reliably. Version 2.48.7 was n8n's stable release when this was written on 23 November 2026. Check the n8n changelog (linked under Sources) and pin the current stable version.

WEBHOOK_URL, N8N_HOST, timezone and the encryption key

Webhook URL and host

n8n builds webhook URLs from N8N_PROTOCOL, N8N_HOST and N8N_PORT. Behind a proxy that gives the wrong answer, because n8n listens on 5678 while the public sees 443. So set the public URL explicitly. From n8n 2.30.0 the variable is N8N_WEBHOOK_URL. On versions before 2.30.0, use WEBHOOK_URL instead. From 2.35.0 WEBHOOK_URL is deprecated and n8n logs a deprecation warning when it is set, so switch to N8N_WEBHOOK_URL. Set N8N_PROXY_HOPS=1 for a single proxy so n8n trusts the forwarded headers. Caddy sends X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host by default, and its reverse proxy also handles WebSocket connections, which the n8n editor uses. If you use Nginx instead, add those headers and the WebSocket upgrade headers yourself.

Timezone

GENERIC_TIMEZONE controls Schedule Trigger and other time-based nodes, and defaults to America/New_York. Without it, a workflow set for 9 a.m. runs at 9 a.m. New York time. TZ sets the container's system clock for scripts and logs. Set both to Asia/Kolkata.

Encryption key

n8n encrypts every saved credential (API keys, OAuth tokens, database passwords) with a key. If you do not set one, n8n generates a random key on first launch and stores it in the config file inside /home/node/.n8n. n8n's backup docs are clear: without that key, a restored database cannot decrypt its credentials. Setting N8N_ENCRYPTION_KEY yourself, as above, means the key also lives in .env, which you can store in a password manager. If you are adding the variable to an existing instance, copy the key from the existing config file rather than generating a new one.

Backups and updates

Full backup

The whole instance on SQLite is the n8n_data volume: database, encryption key and settings. n8n's docs say to stop n8n before copying it, so the SQLite file is consistent. Check the volume name with docker volume ls (Compose prefixes it with the folder name), then:

cd ~/n8n
docker compose stop n8n
docker run --rm -v n8n_n8n_data:/data -v "$PWD":/backup alpine \
  tar czf /backup/n8n-data-$(date +%F).tar.gz -C /data .
docker compose start n8n

Copy the archive and .env off the server. On Postgres, also back up the database with pg_dump.

Exporting workflows

For moving workflows between instances, the n8n CLI exports each workflow and credential as a separate JSON file. Use different folders for each:

docker compose exec -u node n8n n8n export:workflow --backup --output=/home/node/.n8n/backups/workflows/
docker compose exec -u node n8n n8n export:credentials --backup --output=/home/node/.n8n/backups/credentials/

Credentials stay encrypted in this export, so they only import into an instance with the same key. The export does not include users, execution history or variables, so it does not replace the full backup.

Updating

n8n recommends a full backup before every update. On a VPS, a snapshot is the fastest rollback point (see how incremental snapshots work). Then change the image tag in compose.yaml and run:

docker compose pull
docker compose down
docker compose up -d

Read the release notes before jumping several versions. n8n's docs also say that from n8n 3.0, self-hosting will require a Docker-based install, so npm installs are worth moving to Docker now.

Scaling: queue mode with Redis and workers

By default one n8n process receives webhooks, runs the editor and executes every workflow. Queue mode splits this: the main instance puts executions into Redis, and separate worker processes pick them up. Its requirements, from n8n's docs:

  • PostgreSQL. Queue mode over SQLite is not supported.
  • Redis, set with QUEUE_BULL_REDIS_HOST and QUEUE_BULL_REDIS_PORT.
  • EXECUTIONS_MODE=queue on the main instance and every worker.
  • The same N8N_ENCRYPTION_KEY on every worker, or workers cannot read credentials.
  • Workers started with the worker command. Each runs 10 jobs at once by default, changed with --concurrency.

Consider it when long or heavy workflows delay webhook responses, or when one VPS is no longer enough and you want workers on a second server. Queued jobs live in Redis, so if Redis loses its data those executions do not complete. Turn on Redis persistence (AOF) and alert on executions that never finish. For one team's automations, a single instance with Postgres is usually enough.

Common errors and fixes

  • Webhook URLs show http://localhost:5678. N8N_WEBHOOK_URL (or WEBHOOK_URL before 2.30.0) is missing. Add it, then run docker compose up -d so the container is recreated. Then unpublish and publish again any workflow whose trigger registers a webhook with an outside service, so it picks up the new URL.
  • 502 Bad Gateway from the proxy. The proxy cannot reach n8n. Check docker compose ps and docker compose logs n8n: n8n may still be starting, restarting after running out of memory, or the Caddyfile may name the wrong service or port. Our 502 Bad Gateway guide covers the general checks.
  • No certificate, or the browser warns about HTTPS. DNS does not point to the server yet, or port 80 or 443 is blocked. Fix DNS, then restart Caddy.
  • Credentials fail after a redeploy. Either the volume was deleted (docker compose down -v removes named volumes) or n8n started with a different encryption key. Restore the volume backup and the original key.
  • Schedules run at odd hours. GENERIC_TIMEZONE is not set to Asia/Kolkata.
  • "JavaScript heap out of memory" in the logs. Process data in smaller batches, use sub-workflows, or add RAM. n8n's memory guide explains each option.

Running n8n on Bigdomainhost

A Bigdomainhost KVM VPS runs Docker natively with full root access, on servers in Mumbai (BOM-1) or Delhi NCR (DEL-1). The entry Linux plan has 2 vCPU, 4 GB RAM, 40 GB NVMe and 5 TB of transfer, and the current price is on the VPS page. Servers are prepaid in 30-day periods, snapshots are available, and there is no free trial. Support is on WhatsApp at +91 75994 50220 at any time and by phone in IST working hours.

Written by the Bigdomainhost team with AI assistance; facts checked against the linked sources.

Sources (checked )

Answers

Frequently asked questions

Still unsure? Call +91 75994 50220 or write to support@bigdomainhost.com — a human replies in IST hours.

Is n8n self-hosted free?

Yes. The Community edition is free to self-host with almost the full feature set, and you only pay for the server. Some features, such as SSO and environments, need a paid Business or Enterprise licence key.

Is n8n open source?

Not in the OSI sense. Self-hosted n8n uses the Sustainable Use License, which n8n calls fair-code. You can use it for your own business and build automations for clients on your instance, but you cannot offer n8n as a service where customers build their own workflows.

How much RAM does n8n need on a VPS?

n8n does not publish one minimum, because memory use depends on data size, binary files, Code nodes and how many workflows run at once. Its Docker Compose guide asks for at least 4 GB of RAM and 2 vCPUs for the stack with the n8n Assistant code sandbox, and its Hetzner guide says a small plan is enough for most usage without Assistant. Start on 4 GB and watch docker stats before resizing.

Why does my n8n webhook URL show localhost?

n8n builds the URL from its internal host and port unless you tell it the public address. Set N8N_WEBHOOK_URL to your https address (WEBHOOK_URL on versions before 2.30.0) and N8N_PROXY_HOPS to 1, then recreate the container.

Should I use SQLite or Postgres for self-hosted n8n?

SQLite is the default and fine for testing and small personal setups. n8n recommends PostgreSQL for production, and queue mode does not support SQLite. If several people will build workflows, start on Postgres.

What happens if I lose the n8n encryption key?

Saved credentials cannot be decrypted, so every API key and login in your workflows has to be entered again. Keep N8N_ENCRYPTION_KEY or the config file from the .n8n folder in a safe place, separate from the server.

Support that picks up the phone.

In IST hours, in Hindi or English, and WhatsApp replies fastest at any time. Sales, migration and emergencies all reach the same engineers. No offshore queue, no 48-hour first reply.

Need cPanel or WHM with the ports already sorted?

Web & cPanel hosting comes with cPanel ready to log in to, reseller hosting adds white-label WHM, and a KVM VPS can have cPanel & WHM pre-installed. Call +91 75994 50220 or email support@bigdomainhost.com.