🔗
VPS

Repetitive tasks consume endless hours — from posting blog updates to social media automatically, to syncing leads between applications, to scraping data on a schedule. If you've used Zapier or Make.com, you know the monthly bill climbs fast as workflows multiply. n8n is an open-source alternative you can self-host on your own VPS — meaning you control the data, avoid per-task billing, and scale workflows without limits. This guide walks you through installing n8n on a Linux VPS using Docker or Node.js, setting up a reverse proxy with HTTPS, configuring security, and ensuring your workflow data persists across updates.

In short: n8n is an open-source workflow automation platform you can self-host on a VPS to eliminate per-task pricing, ensure data privacy, and run unlimited workflows. The fastest way to set it up is using Docker; configure the environment variables N8N_HOST and WEBHOOK_URL correctly to avoid webhook failures; use Nginx as a reverse proxy with Let's Encrypt SSL; and enable built-in user authentication for security.

What is n8n and Why Self-Host It?

n8n (pronounced "n-eight-n") is an open-source workflow automation platform similar to Zapier and Make.com — but with a crucial difference: you run it on your own hardware. "Self-hosted" means the n8n server runs on your VPS instead of relying on a third-party SaaS provider.

Key benefits of self-hosting n8n:

Real-World Use Cases

Before setting up, here are practical scenarios where n8n shines:

Prerequisites

To install n8n on your VPS, you'll need:

Install n8n Using Docker (Recommended)

Docker eliminates dependency headaches — no Node.js version conflicts, no conflicting system libraries. This is the quickest path to a working n8n setup.

Step 1: Install Docker and Docker Compose

If Docker is not installed, run:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker

Verify the installation:

docker --version
docker run hello-world

Step 2: Create a Directory and Named Volume

Create a directory to store n8n configuration and workflow data:

mkdir -p ~/n8n
cd ~/n8n
docker volume create n8n_data

Named volumes persist even if you remove the container — a critical safeguard for production.

Step 3: Create docker-compose.yml

Create a Docker Compose file:

nano docker-compose.yml

Paste the following content:

version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=automation.yourcompany.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://automation.yourcompany.com/
      - N8N_USER_MANAGEMENT_DISABLED=false
    volumes:
      - n8n_data:/home/node/.n8n
    restart: unless-stopped

volumes:
  n8n_data:

Warning: N8N_HOST and WEBHOOK_URL are the most common setup mistakes. If these are incorrect or mismatched, webhooks will fail silently — your external integrations won't trigger workflows. Ensure both values match your domain name exactly and use HTTPS.

Replace the placeholders with your actual values:

Step 4: Start n8n with Docker

docker-compose up -d

Check that the container is running:

docker ps
docker logs n8n

When you see "Server started successfully" in the logs, n8n is ready — though it's not yet accessible from the internet. We'll fix that with Nginx next.

Set Up Nginx Reverse Proxy and HTTPS

n8n listens only on localhost:5678. To expose it to your domain with HTTPS (required for secure webhooks), we'll use Nginx as a reverse proxy.

Step 1: Install Nginx and Certbot

sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx

Step 2: Create Nginx Configuration

sudo nano /etc/nginx/sites-available/n8n

Paste the following content:

server {
    listen 80;
    server_name automation.yourcompany.com;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;
    }
}

Replace automation.yourcompany.com with your actual domain.

Step 3: Enable the Configuration and Test

sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Step 4: Install SSL with Let's Encrypt

sudo certbot --nginx -d automation.yourcompany.com

Follow the prompts, accept the terms, and allow Certbot to modify your Nginx config automatically. Certbot will automatically redirect all HTTP traffic to HTTPS and set up certificate renewal.

Configure User Authentication

Once n8n is accessible via HTTPS, the first login prompts you to create an admin account. This is your primary security gate — save these credentials securely, as you'll need them to access the n8n dashboard every time.

Tip: For extra security, enable two-factor authentication (2FA) in n8n's user settings, or add Nginx basic authentication by creating a .htpasswd file and adding it to your Nginx config's location block. This adds a second layer of defense.

Ensure Data Persistence and Backup

All workflow definitions, credentials, and execution history are stored in the ~/.n8n directory inside the container. If the container is deleted without a volume, all data is lost. We've already mounted a named volume, but it's wise to add explicit backups.

Verify Volume Persistence

docker volume inspect n8n_data

Set Up Automated Backups

Create a cron job to back up your n8n data daily:

crontab -e

Add this line:

0 2 * * * tar -czf ~/backups/n8n-$(date +\%Y\%m\%d).tar.gz ~/n8n/

This backs up the entire ~/n8n directory every day at 2 AM. Create the ~/backups directory first if it doesn't exist:

mkdir -p ~/backups

Production Considerations

For critical workflows running 24/7, additional hardening steps ensure stability:

Summary

You now have a fully functional, self-hosted n8n instance running on your VPS. Unlike SaaS platforms, there are no per-workflow fees — your VPS investment covers unlimited automation. All your workflow data and credentials stay on your server, giving you full control and privacy.

Next steps: Log in to your n8n dashboard at https://automation.yourcompany.com, create your first simple workflow (e.g., HTTP trigger → send a Slack message), and test it end-to-end. Once comfortable, build more complex automations involving multiple APIs, scheduled jobs, and conditional logic. The sky is the limit.

Frequently Asked Questions

How is n8n different from Zapier or Make.com?

Zapier and Make charge per task execution or monthly based on workflow usage. n8n is open-source and self-hosted, so once deployed on your VPS, workflows run unlimited times at zero cost. You also retain full data control and code access.

Can I run n8n without Docker?

Yes, install Node.js 18+ and npm, then run `npm install -g n8n` followed by `n8n start`. However, Docker is cleaner for production because dependencies are isolated and updates are simpler.

Why aren't my webhooks firing?

Usually caused by N8N_HOST or WEBHOOK_URL being misconfigured. Double-check that both match your domain exactly (e.g., automation.yourcompany.com) with HTTPS, and have no trailing spaces. Review the Docker logs: `docker logs n8n`.

Is there a limit to how many workflows or credentials n8n supports?

No hard limit — it depends on your VPS resources (RAM, disk, CPU). Hundreds of workflows are possible, but with many large workflows or frequent executions, you may need more RAM. If performance degrades, upgrade the VPS or split workflows across multiple instances.

Start Your AsiaGB VPS Today

AsiaGB VPS runs on SSD storage across every plan, with Thailand or Singapore datacenter options and full root access from day one — starting at 500 THB/month (Linux), backed by a Thai support team.

See VPS Plans

View all affordable VPS Thailand plans →