Why Self-Host n8n on a VPS?
n8n is one of the most powerful open-source workflow automation tools available today. While the cloud version is convenient, self-hosting n8n on a Virtual Private Server (VPS) gives you full control over your data, no usage limits, and significant cost savings in the long run.
Whether you are running complex AI pipelines, connecting dozens of APIs, or simply want to keep sensitive business data on your own infrastructure, a self-hosted setup is the professional choice. Providers like Hostinger and Netcup offer affordable VPS plans that are perfectly suited for running n8n reliably.
What You Will Need
- A VPS with at least 1 vCPU and 1 GB RAM (2 GB recommended) — available from Hostinger or Netcup
- Ubuntu 22.04 LTS installed on your server
- A domain name pointed to your server's IP address
- Basic familiarity with the Linux command line
- Docker and Docker Compose installed
Step 1 — Get Your VPS Ready
Start by ordering a VPS from a reliable provider. Hostinger VPS plans are beginner-friendly and come with fast SSD storage, while Netcup offers excellent value for European users with flexible root server options.
Once your VPS is provisioned, log in via SSH:
- Open your terminal
- Run: ssh root@YOUR_SERVER_IP
- Update your system: apt update && apt upgrade -y
Step 2 — Install Docker and Docker Compose
Docker makes running n8n extremely straightforward. Install it with the following commands:
- apt install -y docker.io docker-compose
- Enable Docker on boot: systemctl enable docker && systemctl start docker
- Verify installation: docker --version
Docker Compose allows you to define your entire n8n setup in a single configuration file, making updates and maintenance much simpler.
Step 3 — Create the Docker Compose File for n8n
Create a dedicated directory and a docker-compose.yml file:
- mkdir ~/n8n && cd ~/n8n
- nano docker-compose.yml
Paste the following configuration:
- Service name: n8n
- Image: n8nio/n8n
- Restart policy: always
- Ports: 5678:5678
- Environment variables: set N8N_HOST, N8N_PORT, WEBHOOK_URL, and optionally N8N_BASIC_AUTH_ACTIVE=true with a username and password
- Volumes: mount ~/.n8n:/home/node/.n8n to persist your data
Save the file and start n8n with: docker-compose up -d
Step 4 — Set Up a Reverse Proxy with Nginx
To access your n8n instance via a domain name with HTTPS, you need a reverse proxy. Install Nginx and Certbot:
- apt install -y nginx certbot python3-certbot-nginx
- Create a new Nginx config file for your domain
- Set up a proxy_pass directive pointing to http://localhost:5678
- Run Certbot: certbot --nginx -d yourdomain.com
Certbot will automatically configure SSL and renew certificates, giving your n8n instance a secure https:// address.
Step 5 — Secure and Harden Your Setup
Security is critical when exposing any service to the public internet. Take these steps:
- Enable the firewall: ufw allow OpenSSH && ufw allow 'Nginx Full' && ufw enable
- Enable n8n's built-in basic authentication in your Docker Compose environment variables
- Consider setting up fail2ban to protect against brute-force attacks
- Regularly update your Docker images: docker-compose pull && docker-compose up -d
Step 6 — Access Your n8n Instance
Open your browser and navigate to https://yourdomain.com. You should see the n8n login screen. Log in with the credentials you set in your Docker Compose file and start building your first automation workflow.
Your self-hosted n8n instance is now live, fully private, and ready to power your automation stack — from AI agents to CRM integrations and beyond.
Recommended VPS Providers
Choosing the right hosting partner makes a real difference for uptime and performance. Here are two excellent options:
- Hostinger — Beginner-friendly VPS with a clean control panel, fast NVMe storage, and affordable pricing starting from just a few euros per month.
- Netcup — German-based provider with excellent value root servers and VPS plans, ideal for European businesses and GDPR-conscious users.
Final Thoughts
Self-hosting n8n on a VPS is one of the smartest moves you can make as an automation enthusiast or professional. You get unlimited workflows, full data ownership, and the freedom to extend n8n with custom nodes and integrations — all at a fraction of the cloud subscription cost.
With providers like Hostinger and Netcup offering reliable and affordable infrastructure, there has never been a better time to take your automation setup into your own hands.
This post was created with tools we use and recommend: n8n for workflow automation, Turbotic as an AI-native automation alternative, ElevenLabs for AI voiceover, Placid for visual content creation, and Hostinger for reliable VPS hosting. Some links are affiliate links.