If you’ve been using n8n Cloud but want full control of your automations (and to stop paying monthly fees), self-hosting n8n on your own VPS is a great move.
In this guide, I’ll show you how to install n8n on any VPS using Docker, expose it securely to the public internet using Cloudflare Tunnel (no Nginx, no Let’s Encrypt, no open ports), and configure it for production with your real domain.
Why Self-Host n8n?
Running n8n yourself gives you:
Full data ownership — credentials and workflows stay on your server
Unlimited workflows for a fixed VPS cost
Better integration with private systems and APIs
More control over scaling, logging, and automation triggers
Even a small 2 GB VPS can handle dozens of n8n workflows comfortably.
1. Set Up Your VPS
You can use any provider — Hetzner, DigitalOcean, AWS Lightsail, etc.
Make sure it’s running Ubuntu 22.04 LTS or newer.
Now you’ll be prompted for credentials before accessing the UI.
8. (Optional) Use PostgreSQL for Production
SQLite is fine for small setups, but PostgreSQL is better for reliability and multi-user workflows.
You can easily launch a Dockerized database right next to n8n — I’ve written a separate article for that:
How to Quickly Launch a Docker Instance of PostgreSQL on Your VPS
You should see your self-hosted n8n instance — encrypted, authenticated, and backed by Cloudflare’s network.
No open ports, no Nginx, no manual certificates.
10. Conclusion
You now have your own production-ready n8n Cloud running on your VPS:
Docker handles isolation and persistence
Cloudflare Tunnel provides secure HTTPS without opening ports
WEBHOOK_URL ensures all workflows use your real domain
systemd keeps it online automatically
PostgreSQL (optional) prepares it for scale
You fully own your automation stack — and you can reuse this exact setup for any self-hosted service.
If you want to dive deeper into the Cloudflare setup or connect a database next, check out: