Setting up n8n on a VPS gives you full control over your automation workflows, keeps your data private, and saves money compared to n8n Cloud. In this guide, I will walk you through the complete process of installing n8n on a Hostinger VPS using Docker and Nginx — the exact same setup I use for all my client projects.
I am Usman Abbas, a Top Rated AI Automation Expert from Pakistan on Upwork with 500+ completed projects. This guide is based on my real experience deploying n8n for clients worldwide.
n8n Cloud costs $20-120/month. A Hostinger VPS costs $5-10/month and you can run unlimited workflows with no execution limits.
What You Need Before Starting
- A VPS with at least 1GB RAM (Hostinger KVM 1 works perfectly)
- Ubuntu 22.04 or 24.04 installed
- A domain name pointing to your VPS IP
- Basic knowledge of SSH and terminal commands
Step 1 — Connect to Your VPS
Open your terminal and SSH into your server:
ssh root@YOUR_VPS_IPUpdate your system packages first:
apt update && apt upgrade -yStep 2 — Install Docker
Install Docker and Docker Compose on your VPS:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
apt install docker-compose -yVerify Docker is installed correctly:
docker --version
docker-compose --versionStep 3 — Create n8n Docker Compose File
Create a directory for n8n and the docker-compose file:
mkdir /opt/n8n && cd /opt/n8n
nano docker-compose.ymlPaste this 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/
- GENERIC_TIMEZONE=Asia/Karachi
- TZ=Asia/Karachi
volumes:
- ~/.n8n:/home/node/.n8nStep 4 — Install and Configure Nginx
Install Nginx as a reverse proxy:
apt install nginx -y
nano /etc/nginx/sites-available/n8nAdd this Nginx configuration:
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 site and restart Nginx:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginxStep 5 — Add SSL Certificate (HTTPS)
apt install certbot python3-certbot-nginx -y
certbot --nginx -d your-domain.comStep 6 — Start n8n
cd /opt/n8n
docker-compose up -dVisit https://your-domain.com and you will see the n8n setup screen. Create your admin account and you are ready to build workflows!
~/.n8n folder to Google Drive using — ironically — an n8n workflow itself!Common Issues and Fixes
n8n not loading after setup
Check if the container is running: docker ps. If not, check logs: docker-compose logs n8n
Webhook URLs not working
Make sure WEBHOOK_URL in docker-compose.yml matches your actual domain with HTTPS.
SSL certificate error
Make sure your domain DNS is pointing to your VPS IP before running certbot.
Need Help Setting Up n8n?
I set up n8n on VPS for clients every week. Hire me on Upwork and I will have your n8n running in under 2 hours — guaranteed.
Hire Me on Upwork →Conclusion
Self-hosting n8n on a VPS is one of the best decisions for any serious automation builder. You get unlimited workflows, full data control, and massive cost savings. Follow this guide step by step and you will have n8n running in under 30 minutes.
If you need a pre-configured n8n setup or help building automation workflows, contact me — I am a Top Rated n8n Expert from Pakistan available for projects worldwide.