Power-User · Level 3 of 3
Self-hosting n8n means running a workflow automation platform on your own server. Its Community Edition is source available under the Sustainable Use License, which permits your internal business or personal use subject to its restrictions. You need a VPS, a domain, and the ability to maintain a Linux server. This guide covers a small n8n deployment behind Caddy with owner-account login, HTTPS, webhook configuration, and a stopped-service backup procedure. It does not configure the separate n8n Assistant sandbox stack.
If your workflows no longer fit your Zapier plan, compare the whole workload before moving. Self-hosting adds server, backup, security, and maintenance responsibilities; it does not guarantee a lower total cost. The steps below show a small deployment you can evaluate.
Is n8n free to self-host?
Yes, for uses permitted by its Sustainable Use License. Community self-hosting does not use Cloud execution billing, but it is not unrestricted open-source licensing. Check the terms before hosting the software for other people. n8n Cloud starts at EUR 20/mo (Starter, 2,500 executions) and EUR 50/mo (Pro, 10,000 executions), both billed annually, according to the pricing page checked October 27, 2026. Those hosted plans charge by workflow execution. Server resources, maintenance, and any paid services remain your responsibility when you self-host.
"Free" here means the software, not the hosting. The honest total cost breaks down like this:
| Cost line | Budget input | Notes |
|---|---|---|
| VPS sized for your workload | Obtain a current provider quote | Ranges by provider; check current VPS pricing before you commit |
| Domain (for HTTPS + webhooks) | Varies by registrar | A domain you may already own works; a subdomain is enough |
| Your time (setup) | Untested planning estimate: 1–2 hours | Allow more time for unfamiliar server work and troubleshooting |
| Your time (upkeep) | Untested planning estimate: 15–30 min/mo | Incidents and restore rehearsals can take longer; no measured result |
| n8n Community Edition | $0 | Resources and permitted license use still bound the deployment |
Execution count alone cannot establish payback. Compare your actual nodes, payload sizes, concurrency, and retention with the server quote, domain, off-server backup storage, paid services, and time you will spend maintaining them. Then compare a hosted plan that covers the same workload. A server you control also leaves you responsible for its security and recovery; third-party services used by workflows retain their own dependencies.
What you need before you start (n8n VPS requirements)
Treat any small VPS configuration as an untested starting point, not a capacity assurance. Nodes, payload sizes, concurrent executions, retained data, and other services change the resources needed. Before the first command, get these four things ready:
- A VPS running a supported Ubuntu LTS. A proposed 1 vCPU/2 GB RAM configuration is an untested sizing estimate, not a verified minimum or comfortable capacity. Check requirements for your chosen release and workload before buying; measure representative executions before relying on it.
- A domain or subdomain you can point at the server. You need this for a real HTTPS certificate and for webhook URLs that outside services can reach. An IP address alone will fight you on both.
- SSH access to the VPS as a user who can run Docker.
- Docker and Docker Compose, installed in the steps below.
Pick a provider you are comfortable managing. This walkthrough uses a Hostinger VPS as one example provider, but the commands are the same on any Ubuntu VPS.
Step-by-step: install n8n with Docker Compose
The plan: spin up the VPS, point a subdomain at it, install Docker, then run n8n behind Caddy so HTTPS is issued and renewed for you. Check certificate issuance in the logs; DNS resolution alone does not establish that every issuance requirement is met.
1. Create the VPS and log in
Create an Ubuntu LTS VPS in your provider's panel and note its public IP. Then connect over SSH from your own machine:
ssh root@YOUR_SERVER_IP
Update the system first:
apt update && apt upgrade -y
2. Point a subdomain at the server
In your domain registrar's DNS settings, add an A record for a subdomain (for example n8n.yourdomain.com) pointing to the VPS public IP. DNS can take a few minutes to propagate. Caddy will not be able to issue a certificate until this record resolves, so do this before bringing the stack up.
3. Install Docker and the Compose plugin
Use Docker’s official Ubuntu apt-repository instructions. Check its supported Ubuntu versions and remove conflicting packages only after reviewing the host. Add Docker’s signing key and repository exactly as documented, then install the packages below as your administrative user. The convenience script is intended for testing and development, not this production walkthrough.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
docker compose version
Confirm the Engine service and the hello-world check succeed as well as checking the Compose version.
4. Write the docker-compose file
Create a working directory and a docker-compose.yml. This example is for n8n 2.35.0 or newer with the documented N8N_WEBHOOK_URL setting, one Caddy proxy, and a single-instance SQLite data directory. Select an exact, currently supported patch release from n8n’s release notes, and an exact supported Caddy 2 patch tag. Record them in ~/n8n/.env as N8N_VERSION=your-selected-exact-tag and CADDY_VERSION=your-selected-exact-tag. Replace those placeholders before starting; do not use latest. This is a configuration example, not a deployment tested on a VPS.
mkdir -p ~/n8n && cd ~/n8n
nano docker-compose.yml
Paste this, replacing the example domain and timezone. Compose requires both version variables from the adjacent .env file; an unset variable stops configuration instead of silently choosing a moving tag. Protect the directory and .env from other users. The commands assume the root session established above; membership in the Docker group also gives powerful host access.
services:
n8n:
image: docker.n8n.io/n8nio/n8n:${N8N_VERSION:?Set an exact supported n8n tag in .env}
restart: unless-stopped
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- N8N_WEBHOOK_URL=https://n8n.yourdomain.com/
- N8N_PROXY_HOPS=1
- N8N_EDITOR_BASE_URL=https://n8n.yourdomain.com/
- GENERIC_TIMEZONE=America/New_York
volumes:
- n8n_data:/home/node/.n8n
caddy:
image: caddy:${CADDY_VERSION:?Set an exact supported Caddy2 tag in .env}
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
volumes:
n8n_data:
caddy_data:
caddy_config:
Now create the Caddyfile next to it. Caddy reads your domain, requests a certificate, and reverse-proxies to n8n:
nano Caddyfile
n8n.yourdomain.com {
reverse_proxy n8n:5678
}
5. Bring the stack up
Start both containers in the background:
docker compose up -d
Watch the logs until Caddy reports a certificate and n8n reports it is ready:
docker compose logs -f
Open https://n8n.yourdomain.com yourself and complete the owner-account setup before letting other people access the instance. Use a unique password and configure supported account recovery; n8n recommends SMTP for password resets. Built-in basic authentication was removed in n8n 1.0, so the old N8N_BASIC_AUTH_* variables do not protect this installation. Test sign-out and sign-in through HTTPS. Do not assume an editor login protects every webhook; configure authentication on each webhook that needs it.
Make webhooks and HTTPS actually work
Behind one Caddy proxy, set N8N_WEBHOOK_URL to the public HTTPS address and N8N_PROXY_HOPS=1. The older WEBHOOK_URL name is deprecated starting in n8n 2.35.0. Caddy supplies X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto by default; verify those headers reach n8n. If you add a CDN or another proxy, revisit the trust and hop configuration rather than copying the single-proxy value. See the n8n proxy guide and Caddy header defaults.
Two checks before you trust it:
- Open a workflow with a Webhook node and confirm the Production URL it shows starts with your
https://domain, not an internal address. - From another machine, send a test request to that URL and confirm n8n receives it. Use non-sensitive test data, publish the workflow if required for its Production URL, and check the execution log and returned response. A valid certificate alone does not establish that the workflow is configured correctly.
Check HTTPS after deployment and monitor certificate errors afterward. If issuance fails, inspect Caddy’s logs, DNS resolution, inbound connectivity, and the certificate authority’s reported error. Do not assume one of these checks establishes the cause without the corresponding error evidence.
Back up your n8n data
For this single-instance SQLite setup, stop n8n before copying its data directory so database files are not changing during the copy. Allow for downtime and interrupted executions. Preserve the entire .n8n directory, including encryption/configuration material, plus the Compose file, Caddyfile, and protected .env. If you configure an external encryption key, retain it securely too. An archive without the key needed for credentials is not a usable recovery plan. PostgreSQL, external binary storage, and multiple writers require their own coordinated backup procedure; this sample does not cover them.
Save the following as /root/n8n/backup-n8n.sh and run it with sh /root/n8n/backup-n8n.sh during a maintenance window. It copies from the stopped container rather than guessing Compose’s volume name. Its exit handler attempts to restart n8n even on an error; afterward, check docker compose ps, login, and a harmless workflow yourself. An error must be investigated, not treated as a successful backup.
set -eu
umask 077
cd /root/n8n
docker compose config --quiet
mkdir -p /root/backups
backup_dir=$(mktemp -d /root/backups/n8n-$(date +%Y%m%dT%H%M%S)-XXXXXX)
docker compose stop n8n
trap 'docker compose start n8n >/dev/null' EXIT
docker compose cp n8n:/home/node/.n8n "$backup_dir/data"
cp docker-compose.yml Caddyfile .env "$backup_dir/"
tar -czf "$backup_dir.tar.gz" -C "$backup_dir" .
tar -tzf "$backup_dir.tar.gz" >/dev/null
printf 'Archive created: %s\n' "$backup_dir.tar.gz"
A successful archive listing only checks that tar can read the archive. Copy it to access-controlled, encrypted off-server storage, retain older copies, and rehearse an isolated restore. Use an empty test data directory and the matching application version; keep the restored instance away from production credentials, outbound services, schedules, and public webhook traffic. Check workflows and credential decryption without firing real actions. No restore was performed for this article. Do not overwrite the working volume to experiment with restoration.
Only after a supervised backup and isolated restore rehearsal, consider scheduling this wrapper. The cron line below contains no date-format percent signs; those remain inside the shell script. Monitor failures and confirm the service restarted. A nightly job will interrupt running work, so choose a maintenance window that fits your workflows.
0 3 * * * /bin/sh /root/n8n/backup-n8n.sh >> /root/n8n-backup.log 2>&1
Keep n8n updated
n8n ships new versions often, and self-hosting means you apply them. The update is a pull-and-recreate:
cd ~/n8n
docker compose pull
docker compose up -d
Before changing versions, make a consistent backup, read the release and migration notes, and choose the exact replacement image tag in .env. Run docker compose config --quiet, pull, and recreate. Then check login, credential decryption, and a harmless workflow. A named volume surviving container recreation does not guarantee a database migration can be reversed; rollback can require the matching pre-upgrade backup. Review security notices between routine maintenance windows.
Where self-hosting breaks
Check these failure points before relying on the instance:
- Webhook URLs pointing inward. If
N8N_WEBHOOK_URLis unset or wrong, external triggers silently fail. Set it to your public HTTPS address, as in the compose file above. - SSL certificate never issues. Read the issuance error in Caddy’s logs. Confirm DNS points to this server and check the challenge’s required connectivity; investigate the specific error before changing settings.
- Skipped backups. The one time you need a backup is after something breaks. Automate it with cron and copy archives off-server.
- Updates left too long. Falling many versions behind makes eventual upgrades riskier. Small, regular updates beat one large jump.
- Running out of memory. If executions hang or a container restarts, inspect application/container logs and memory, CPU, and disk use. Establish whether a resource shortage, workflow error, or external dependency caused the failure. Add RAM only when the evidence supports it; an upgrade is not a general repair.
Self-host, n8n Cloud, or stay on Zapier?
Choose self-hosting when control of the deployment justifies operating it and your full workload budget supports that choice. It is a Power-User path with server and recovery responsibilities. Lower cost is a comparison to calculate, not an outcome this untested example establishes.
Consider n8n Cloud when you prefer managed hosting and a current plan covers your workload. Keeping Zapier can also be sensible when its integrations and allowance meet your needs. Compare current billing units, required features, and maintenance effort instead of assuming volume makes one route cheaper. Include migration and recovery work in that decision.
Once your instance is live, the next question is what to build on it. For workflow ideas to evaluate after the deployment is ready, see 15 workflow automations that save solopreneurs 5 hours a week. If you want a lighter warm-up before wiring up full workflows, automating your inbox with Gmail filters and labels is a fast win that needs no server at all.
Keep the first deployment small. Owner login, a reachable authenticated webhook where needed, protected configuration, and a rehearsed recovery path matter more than adding another workflow. If those responsibilities do not fit your time or skills, use a hosted plan or keep the tool that already works. Expand only after the basic setup and fallback are understood.
Evidence and verification
Targeted documentation update: October 27, 2026; cost and troubleshooting language repaired October 28. This desk-researched repair checked n8n’s login guidance, license, annual Cloud billing, proxy configuration, and data persistence guidance, plus Docker installation/volume documentation and Caddy proxy headers. No VPS deployment, login, webhook execution, backup, or restore was tested. The VPS quote must come from your provider; the sizing and setup/upkeep figures beside the table are untested planning estimates. This targeted repair is not a full revalidation of every carried-forward claim. Check current provider requirements before buying.
Leave a Reply