How to Install n8n on Your Own VPS: A Step By Step Tutorial
Learn how to host n8n on your own VPS. No subscriptions. No limits. Just full control.
From server setup to secure access, this step-by-step guide puts your automation platform entirely in your hands.
- Easy Set Up
- Minimum Codes & Commands
- Runs 24/7 on Your Server
Contents
ToggleStep 1: Get a VPS
Choose a VPS with at least 3 vCPUs and 8 GB RAM. Set billing to monthly, choose NVMe storage, and set a root password.
Step 2: Download PuTTY
Download PuTTY, paste the VPS IP, name your session, and connect using your root password.
Step 3: Install Portainer
docker volume create portainer_data docker run -d -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest Step 4: Go to Portainer
Replace your-server-ip with your VPS IP, then open it in your browser and then Replace your-server-ip with your VPS IP, then open it in your browser.
http://your-server-ip:9000 Step 5: Create a Stack in Portainer
Go to Stacks > Add Stack Give it a name:
n8n-stack Replace the username, password, host, and webhook URL with your own values, then paste the Docker Compose and click Deploy the Stack.
version: "3"
services:
npm:
image: jc21/nginx-proxy-manager:latest
container_name: nginx-proxy-manager
restart: always
ports:
- "80:80"
- "81:81"
- "443:443"
volumes:
- ./data/npm:/data
- ./data/letsencrypt:/etc/letsencrypt
networks:
- proxy
n8n:
image: n8nio/n8n
container_name: n8n
restart: always
environment:
- N8N_HOST=automation.keyconfig.com
- WEBHOOK_URL=https://automation.keyconfig.com/
- N8N_PORT=5678
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=yourpassword
- N8N_COMMUNITY_PACKAGE_MANAGEMENT=true
volumes:
- ./data/n8n:/home/node/.n8n
networks:
- proxy
networks:
proxy:
driver: bridge Step 6: Fix volume permissions for n8n
SSH into your server and run:
sudo chown -R 1000:1000 /data/compose/1/data/n8n Step 7: Access NGINX Proxy Manager (NPM)
Replace your server IP with your VPS IP, then open it in your browser.
http://your-server-ip:81 Login with the default credentials, then change them when prompted:
Email: [email protected]
Password: changeme Step 7: Set up a Proxy Host in NPM
Go to Proxy Hosts > Add Proxy Host: Click Save — and you're done!
Domain Name: automation.keyconfig.com Forward Hostname / IP: n8n
Forward Port: 5678
✅ Websockets Support: ON
✅ Block Common Exploits: ON SSL tab:
✅ Enable SSL
✅ Force SSL
✅ HTTP/2 Support
Choose Request a new SSL certificate
Enter your real email
✅ Accept Let's Encrypt terms Contents
° 00:00 A User Asked
° 00:15 Why Self-Hosting?
° 00:33 Choosing the Right VPS Provider
° 00:46 Picking a Plan: What Specs You Need
° 01:12 VPS Setup: Region, Currency, Storage, OS
° 01:59 Setting the Root Password
° 02:14 Creating or Logging into Your Account
° 02:28 Backup Option (Optional)
° 02:37 Order and Payment
° 02:49 VPS Delivered + Account Verification
° 03:15 Checking Your Email for VPS Details
° 03:50 Installing PuTTY to Access the VPS
° 04:26 Pointing Your Subdomain via Cloudflare
° 05:28 Connecting to the VPS via PuTTY
° 05:54 Logging in with Root Credentials
° 06:13 Installing Portainer (Docker Management UI)
° 06:41 Accessing Portainer via Browser
° 07:09 Creating the Portainer Admin Account
° 07:48 Creating a Stack for n8n
° 08:14 Editing the Docker Compose Config
° 08:58 Deploying the Stack
° 09:46 Verifying Container Status
° 09:56 Fixing n8n Volume Permissions
° 10:10 Accessing NGINX Proxy Manager
° 10:42 Logging into NGINX Proxy Manager
° 11:02 Setting Up Your Admin Details
° 11:44 Choosing a Strong Password
° 12:05 Adding a New Proxy Host
° 12:28 Configuring Domain, Port, and Security
° 13:04 SSL Setup and Final Save
° 13:13 Accessing Your n8n Instance
° 13:19 Creating Your n8n Admin Account
° 13:30 Survey (Optional)
° 13:47 Creating Your First Workflow
° 14:04 Adding a Webhook
° 14:13 Everything Works – You Did It!
° 14:18 Recap and Final Words