I still remember the day my automation bill crossed $300 on a popular cloud platform. As an independent builder, that was my breaking point. I knew there had to be a better way to run workflows without bleeding cash every single month. That is when I decided to shift my entire operation to a self-hosted instance of n8n.
By hosting n8n on my own Virtual Private Server (VPS), I reduced my automation expenses by over 95%. Today, I run hundreds of complex business workflows for less than $5 a month. In this guide, I will share the exact step-by-step setup I used so you can do the same, covering server selection, docker configuration, SSL routing, and basic hardening to protect your data from external threats.
Why Self-Hosting n8n is a Game-Changer
While cloud automation platforms charge you per execution (meaning a simple loop can burn through your budget in minutes), a self-hosted VPS gives you unlimited workflow executions. Your only limit is the hardware capacity of your server, which is more than enough to handle thousands of tasks daily. For example, a basic $4/month VPS can easily process over 50,000 runs per day without sweating.
Let's look at a realistic operational cost breakdown over a typical business month to see how the numbers stack up:
| Platform Provider | Average Run Limit | Cost (per month) | Extra Charge Fee |
|---|---|---|---|
| Zapier Professional | 2,000 tasks | $49.00 USD | $0.02 per task |
| Make.com Core | 10,000 ops | $9.00 USD | $0.001 per op |
| n8n Cloud Starter | 2,500 executions | $20.00 USD | Plan block upgrades |
| Self-Hosted n8n VPS | Unlimited (100k+) | $4.00 - $6.00 USD | $0.00 (Zero) |
"Self-hosting is the only way to build sustainable, high-volume automation systems without constantly worrying about execution quotas or scale pricing traps."
Step 1: Choose a Cheap, Reliable VPS Provider
To get started, you need a basic VPS. A simple virtual server with 1 vCPU and 1GB RAM is perfect for starting out. For this setup, we recommend using reputable infrastructure providers like Hetzner Cloud, DigitalOcean, or Hostinger Cloud VPS. They offer fast SSD storage, stable networks, and a choice of server locations close to your main target audience.
Once your server is spin up, select Ubuntu 24.04 LTS or Ubuntu 22.04 LTS as your default operating system. These distributions have the best package support for Docker and docker-compose tools.
Step 2: Connect via SSH and Harden Your Server
Before installing anything, we must perform basic security hardening. In the automation world, your server holds secret API keys and credentials. Leaving default ports open or allowing raw root logins is a massive security risk.
Open your local terminal and log into your server via SSH:
ssh root@your_server_ip
Once logged in, update your system repositories and packages to patch known kernel vulnerabilities:
sudo apt update && sudo apt upgrade -y
Next, let's configure the Uncomplicated Firewall (UFW) to block all unauthorized traffic, only opening SSH (22), HTTP (80), and HTTPS (443) ports:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
UFW is now active. Any attempt to reach ports other than 22, 80, or 443 will be dropped at the firewall level.
Step 3: Install Docker and Docker Compose
Instead of executing a messy single-line run command, we will use Docker Compose. This allows us to define our n8n configuration, databases, and network adapters in a clean YAML file that can be updated in seconds.
Install the Docker engine and its compose plugin using the official Docker helper script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Verify that both Docker and Docker Compose are installed correctly:
docker --version
docker compose version
Step 4: Create the Docker Compose Deployment Configuration
Create a dedicated directory to store your n8n configuration and transition into it:
mkdir ~/n8n-setup && cd ~/n8n-setup
Now, create a file named docker-compose.yml using your editor of choice (like nano):
nano docker-compose.yml
Insert the following service specification. Note that we store n8n data inside a persistent docker volume named n8n_data so your workflow states are preserved across server reboots:
version: '3.8'
services:
n8n:
image: docker.n8n.io/n8nio/n8n:latest
container_name: n8n_app
restart: unless-stopped
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=n8n.agenticspulse.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.agenticspulse.com/
- GENERIC_TIMEZONE=Asia/Jakarta
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
driver: local
[!IMPORTANT] Make sure to replacen8n.agenticspulse.comwith your actual subdomain pointing to your VPS IP address in your Cloudflare or DNS provider console. Also, binding the port to127.0.0.1:5678ensures that n8n is not exposed directly to the public web, forcing all traffic to route securely through our reverse proxy.
Step 5: Configure Reverse Proxy and Let's Encrypt SSL
To access n8n securely over HTTPS, we need a reverse proxy. We will install **Nginx** and use **Certbot** to automatically provision and renew a free Let's Encrypt SSL certificate.
Install Nginx:
sudo apt install nginx -y
Create an Nginx configuration file for your n8n subdomain:
sudo nano /etc/nginx/sites-available/n8n
Paste the following proxy block, which forwards external web requests to our local Docker container port:
server {
server_name n8n.agenticspulse.com;
location / {
proxy_pass http://127.0.0.1:5678;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
Enable the site configuration by creating a symlink to the active directory, and restart Nginx:
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Now, install Certbot and its Nginx helper to automatically configure SSL certificates:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d n8n.agenticspulse.com
Certbot will ask for your email and confirm if you want to redirect all HTTP traffic to HTTPS. Select **Redirect**. Your configuration file will be updated automatically with SSL parameters and security ciphers.
Step 6: Spin Up the Stack
With all configuration files in place, head back to your setup directory and boot up the n8n application in detached mode:
cd ~/n8n-setup
docker compose up -d
Monitor the startup logs to ensure everything initialized without errors:
docker compose logs --tail=50 -f
Once you see the server boot message, navigate to `https://n8n.agenticspulse.com` in your browser. You will be prompted to set up your primary administrator email and password to secure the application dashboard.
Summary: Is Self-Hosting Worth the Effort?
Self-hosting n8n is undoubtedly the best investment a bootstrapping builder can make in 2026. Setting this up takes less than 15 minutes, but it completely frees you from execution anxiety and tag tariff inflation. If you want to scale your automation business without scaling your SaaS liabilities, owning your server stack is the ultimate competitive advantage.
Frequently Asked Questions
1. Can n8n self-hosted run out of memory?
Yes. If you run multiple heavy memory tasks (like processing large CSV files or local AI models) concurrently, a 1GB VPS might crash. You can optimize memory usage by setting EXECUTIONS_PROCESS=main in your environment parameters or upgrading to a 2GB RAM server.
2. How do I update my self-hosted n8n version?
Since we used Docker Compose, upgrading is incredibly easy. Just navigate to your setup folder, pull the latest image, and restart the containers:
cd ~/n8n-setup
docker compose pull
docker compose up -d
3. Is my data safe on a self-hosted instance?
As long as you follow our basic hardening guidelines (blocking open ports via UFW, using HTTPS via SSL, and choosing strong passwords), your system is highly secure. You are also in full control of where your credentials are stored rather than trusting third-party server rooms.