How to Self-Host n8n on a VPS Guide

If you have been looking for a way to automate your workflows without paying high monthly fees, n8n is one of the best tools available right now. You can connect your apps, build automations, and run AI-powered workflows — all from a single dashboard.

The cloud version of n8n can cost anywhere from $20 to $500 per month depending on how many workflows you run. But when you host n8n on your own VPS, you pay only for the server — usually around $5 to $10 per month — and you get unlimited workflows with no usage limits.

In this guide, we will walk you through the complete process of setting up n8n on a VPS, step by step.

What is n8n?

n8n is an open-source workflow automation tool. Think of it as a self-hostable version of Zapier or Make. It connects over 400 apps and services and lets you build automation pipelines through a visual drag-and-drop editor — no coding required for most tasks.

Some of the most common things people use n8n for:

  • Automating lead capture and CRM updates
  • Sending automated emails and notifications
  • Connecting AI models like ChatGPT to trigger actions
  • Processing form submissions and webhook data
  • Scheduling regular reports and data syncs

Why Host n8n on a VPS?

  • Cost: A VPS costs $5–10/month. n8n Cloud starts at $20/month and goes up fast
  • No execution limits: Run as many workflows as your server can handle
  • Data privacy: Your workflow data stays on your own server
  • Full control: Install custom nodes and configure everything your way
  • Internal access: Connect to services not available on the public internet

What You Need Before Starting

  1. A VPS with at least 2 GB RAM — Lvato VPS plans are a great option for this
  2. Ubuntu 22.04 or 24.04 LTS installed on your server
  3. A domain name pointed to your VPS IP address
  4. SSH access to your server
  5. Basic comfort with running Linux terminal commands

Step 1: Update Your Server

Log in to your VPS via SSH and run the following command to make sure everything is up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install Docker

n8n runs inside a Docker container, which makes it simple to install, update, and manage. Install Docker using the official script:

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

Verify Docker is working by running: docker –version

Step 3: Create the Docker Compose File

Create a folder for n8n and add the Docker Compose configuration:

mkdir ~/n8n && cd ~/n8n nano docker-compose.yml

Paste the following into the file. Replace yourdomain.com with your actual domain name:

version: ‘3.8’ services: n8n: image: n8nio/n8n restart: always ports: – “5678:5678” environment: – N8N_HOST=n8n.yourdomain.com – N8N_PORT=5678 – WEBHOOK_URL=https://n8n.yourdomain.com/ – N8N_PROTOCOL=https volumes: – n8n_data:/home/node/.n8n volumes: n8n_data:

Step 4: Install and Configure Nginx

Nginx acts as a reverse proxy, forwarding traffic from port 80 and 443 to your n8n instance on port 5678.

sudo apt install nginx -y sudo nano /etc/nginx/sites-available/n8n

Paste this configuration block (replace yourdomain.com with your domain):

server { listen 80; server_name n8n.yourdomain.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; } }
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx

Step 5: Enable SSL with Let’s Encrypt

Secure your n8n instance with a free SSL certificate. Run the following commands:

sudo apt install certbot python3-certbot-nginx -y sudo certbot –nginx -d n8n.yourdomain.com

Follow the on-screen prompts. Certbot will automatically configure HTTPS and set up auto-renewal for your certificate.

Step 6: Start n8n

Now you are ready to launch your n8n instance:

cd ~/n8n docker compose up -d

Open your browser and go to https://n8n.yourdomain.com. You will be asked to create an admin account on your first visit. That is it — your n8n instance is live.

Troubleshooting

n8n is not accessible

Make sure your firewall allows traffic on ports 80 and 443:

sudo ufw allow 80 && sudo ufw allow 443

Container keeps restarting

Check the logs to find the error: docker compose logs -f n8n — this is usually caused by low RAM or a misconfigured environment variable.

SSL certificate fails

Make sure your domain’s DNS A record is pointing to your VPS IP and has had time to propagate (usually 5–15 minutes).

💡 Pro Tip: Back up your n8n data regularly. Your workflows are stored in the n8n_data Docker volume. Losing this without a backup means losing all your workflows. Set up a daily cron job to export a copy to a safe location.

Ready to Get Started?

At Lvato, our VPS plans are perfectly suited for self-hosting n8n. You get full root access, SSD storage, and the performance you need — starting at an affordable monthly price.

👉 Check out Lvato VPS Hosting: https://lvato.com/vps-hosting

Related Articles

VPS vs Shared Hosting: What Is Best for You in 2026?

When you are running a website, you have a lot of different choices you need to make, and one of the most important ones is the hosting service you choose for your website. In this article, we are going to discuss the difference between VPS hosting and shared hosting...

How to Choose the Right Web Hosting Plan

Choosing the right web hosting plan that fulfills your needs and fits your budget can be confusing as there are a lot of companies which claim to be the top 10 or top 5 providers. Lets see what plan you should use for your website. Defining needs for the website? As...

Make Website Speed Faster and Improve Performance

Website speed is a critical factor in delivering a great user experience and improving your website's overall performance. A fast website not only helps in reducing bounce rates but also boosts your SEO rankings, improves conversion rates, and enhances customer...