Skip to main content
Tutorials12 min read

How to Self-Host n8n on a VPS: Complete 2026 Guide

Learn how to set up n8n workflow automation on your own VPS server with Docker. Step-by-step guide covering installation, SSL, backups, and optimization.

By AutomationVPS

Why Self-Host n8n?

n8n is one of the most powerful open-source workflow automation tools available today. While n8n offers a cloud-hosted version, self-hosting on your own VPS gives you complete control, unlimited executions, and significant cost savings. If you're running more than a few hundred automations per month, self-hosting is a no-brainer.

With n8n Cloud, pricing starts at $20/month for just 2,500 executions. A VPS costing $5-10/month gives you unlimited executions. The math is simple.

What You'll Need

Before we start, make sure you have:

  • A VPS with at least 2 GB RAM and 1 vCPU (we recommend Hostinger VPS starting at $4.99/mo or DigitalOcean starting at $6/mo)
  • A domain name pointed to your VPS IP address
  • Basic familiarity with Linux command line
  • SSH access to your server

Step 1: Prepare Your VPS

First, connect to your VPS via SSH and update the system:

ssh root@your-server-ip
apt update && apt upgrade -y

Step 2: Install Docker

Docker is the easiest way to deploy n8n. Install it with these commands:

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
apt install docker-compose -y

Step 3: Create Docker Compose File

Create a directory for n8n and set up the Docker Compose configuration:

mkdir -p /opt/n8n && cd /opt/n8n
# docker-compose.yml
version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.yourdomain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.yourdomain.com/
      - GENERIC_TIMEZONE=UTC
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Step 4: Start n8n

Launch n8n with Docker Compose:

docker-compose up -d

Your n8n instance is now running! Access it at http://your-server-ip:5678

Step 5: Set Up SSL with Nginx

For production use, you'll want SSL. Install Nginx and Certbot:

apt install nginx certbot python3-certbot-nginx -y

Create an Nginx configuration for n8n, then run Certbot to get a free SSL certificate:

certbot --nginx -d n8n.yourdomain.com

Optimization Tips

To get the most out of your self-hosted n8n:

  • Enable PostgreSQL -- Replace the default SQLite with PostgreSQL for better performance with complex workflows
  • Set up backups -- Use cron jobs to backup your n8n data volume regularly
  • Monitor resources -- Use htop or a monitoring tool to keep an eye on CPU and RAM usage
  • Use a queue mode -- For high-volume workflows, enable n8n's queue mode with Redis
  • Keep it updated -- Regularly pull the latest n8n Docker image for new features and security fixes

Which VPS Should You Choose?

Based on our testing, here are our top recommendations for hosting n8n:

  • Hostinger VPS -- Best overall value with easy-to-use control panel. KVM 1 plan ($4.99/mo) offers 4GB RAM.
  • DigitalOcean -- Best documentation and one-click apps. $12/mo for a comfortable setup.
  • Contabo -- Most resources for the price. 4 vCPU and 8GB RAM at $4.50/mo.

Conclusion

Self-hosting n8n on a VPS is one of the best investments you can make for your automation workflow. For as little as $5/month, you get unlimited workflow executions, full data ownership, and the flexibility to customize everything to your needs.

Get started today with one of our recommended VPS providers and follow this guide step by step. In less than 30 minutes, you'll have a fully functional n8n instance running on your own server.

Ready to start automating? Get a VPS today.

Get started with Hostinger VPS hosting today. Special pricing available.

Get Hostinger VPS

* Affiliate link — we may earn a commission at no extra cost to you

#n8n#self-hosting#docker#automation