This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
Why Self-Host n8n Instead of Using the Cloud Version?
n8n's cloud plan is convenient, but it comes with workflow limits, execution caps, and a monthly fee that grows as your automations scale. Self-hosting on a Virtual Private Server (VPS) gives you unlimited workflows, full data ownership, and a flat infrastructure cost — often under €10 per month.
If you want to run n8n without restrictions, the first thing you need is a reliable VPS. Hostinger offers web and VPS hosting with a one-click n8n template, which means you can skip most of the manual setup and go live in minutes.
What You Need Before You Start
- A VPS with at least 1 vCPU and 1 GB RAM (2 GB recommended)
- Ubuntu 22.04 LTS (or similar Debian-based distro)
- A domain name pointed to your server's IP address
- SSH access to your server
- Basic comfort with the Linux command line
Step 1 — Connect to Your VPS via SSH
Open your terminal and connect to your server:
ssh root@your-server-ip
Once logged in, update the system packages before doing anything else:
apt update && apt upgrade -y
Step 2 — Install Docker and Docker Compose
n8n runs best inside Docker, which keeps the installation clean and easy to update.
apt install -y docker.io docker-compose
Enable Docker to start on boot:
systemctl enable docker
systemctl start docker
Step 3 — Create the n8n Docker Compose File
Create a working directory and a docker-compose.yml file:
mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml
Paste the following configuration:
version: '3'
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- '5678:5678'
environment:
- N8N_HOST=your-domain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://your-domain.com/
volumes:
- ~/.n8n:/home/node/.n8n
Replace your-domain.com with your actual domain. Save and exit with Ctrl+X, then Y.
Step 4 — Set Up a Reverse Proxy with Nginx and HTTPS
Running n8n on plain HTTP is not safe for production. Use Nginx as a reverse proxy and Certbot for free SSL certificates.
apt install -y nginx certbot python3-certbot-nginx
Create an Nginx config for your domain:
nano /etc/nginx/sites-available/n8n
Add this configuration block:
server {
server_name your-domain.com;
location / {
proxy_pass http://localhost:5678;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
}
Enable the config and obtain your SSL certificate:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
certbot --nginx -d your-domain.com
systemctl reload nginx
Step 5 — Start n8n
Navigate back to your n8n directory and bring the container up:
cd ~/n8n
docker-compose up -d
Visit https://your-domain.com in your browser. You should see the n8n setup screen. Create your admin account and you're ready to build workflows.
Step 6 — Keep n8n Updated
Updating is straightforward with Docker:
docker-compose pull
docker-compose up -d
Run this whenever a new n8n version is released to stay current and secure.
Useful Tips for a Stable Setup
- Backups: Regularly back up the
~/.n8nfolder — it contains all your workflows and credentials. - Firewall: Use
ufwto allow only ports 22, 80, and 443. - Monitoring: Add a simple uptime monitor (e.g. UptimeRobot free tier) so you know if n8n goes down.
- Resources: If you run many concurrent workflows, upgrade to a 2 GB or 4 GB RAM VPS plan.
Is Self-Hosting n8n Worth It?
For anyone running more than a handful of automations, the answer is almost always yes. You eliminate per-execution pricing, retain full control over your data, and can integrate with internal tools that the cloud version can't reach. The initial setup takes about 30 minutes, and maintenance afterwards is minimal.
If you want to self-host n8n without wrestling with complex server configuration, you can get started via Hostinger — including a one-click n8n VPS template — to go from zero to a running automation server in minutes.