How to Self-Host n8n on a VPS: A Complete Beginner's Guide (2025)
Self-hosting n8n gives you unlimited workflow executions, full data control, and a flat monthly server cost instead of per-execution pricing. If you can copy-paste a few commands, you can do this. Here’s the complete 2025 walkthrough.
What you’ll need
- A VPS with at least 2GB RAM (Hostinger, DigitalOcean, Hetzner all work well)
- A domain or subdomain pointing to the server
- Basic terminal access via SSH
Step 1 — Prepare the server
SSH in, update packages, and install Docker and Docker Compose. Docker is the cleanest way to run n8n because upgrades become a single command and nothing pollutes your host system.
Step 2 — Configure environment variables
Set N8N_HOST to your domain, WEBHOOK_URL to the HTTPS address, a timezone, and a strong basic-auth user and password. These four settings prevent the most common “my webhooks don’t fire” problems.
Step 3 — Add HTTPS with a reverse proxy
Put Caddy or Nginx + Let’s Encrypt in front of n8n. Caddy is the beginner favorite because it provisions and renews SSL certificates automatically with almost no config.
Step 4 — Persist your data
Mount a Docker volume for the n8n data directory and use an external Postgres database for production. This keeps your workflows and credentials safe across container restarts and upgrades.
Your instance is live — now make it earn its keep.
Drop in a Data Analytics AI Agent that pulls from GA4, HubSpot and Sheets and delivers plain-English business insights on a schedule. The perfect first serious workflow.
Step 5 — Back it up
Schedule a nightly dump of your Postgres database and the data volume to off-server storage. Five minutes of setup now saves you from a catastrophic loss later.
Step 6 — Update safely
To upgrade, pull the new image and recreate the container. Because your data lives in a volume and database, upgrades are painless and reversible.
You’re done
You now have a private, unlimited n8n instance for the cost of a small VPS. Import a ready-made workflow and you’ll have real automation running today.
Ready to automate?
Don’t build this from scratch. The Data Analytics AI Agent template gives you a production-ready n8n workflow you can import, connect your accounts, and run in minutes.