Short answer
Two containers are enough: n8n, and Caddy in front of it to get the HTTPS certificate on its own. On a 1 vCPU, 2 GB VPS running Ubuntu 24.04, the setup below was online in about two minutes, n8n used 486 MB of RAM at idle, and moving from n8n 3.3.0 to 3.4.3 took 19 seconds of downtime with every workflow still there.
What you need
- A Linux VPS with 2 GB of RAM and Ubuntu 24.04. The n8n image alone takes 1.92 GB of disk.
- Root access, or a user with sudo.
- A domain name with an A record pointing to the server's IP, for example
n8n.example.com. No domain yet?203-0-113-10.sslip.io(your IP with dashes) points to203.0.113.10and is enough to get a real certificate for a test. - Ports 80 and 443 reachable from the internet: Let's Encrypt checks the domain through them.
1. Install Docker and Docker Compose
Ubuntu 24.04 ships both in its own repositories. On our test server, the install took 15 seconds.
sudo apt update
sudo apt install -y docker.io docker-compose-v2
docker --version
docker compose versionDocker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
Docker Compose version 2.40.3+ds1-0ubuntu1~24.04.1If you would rather follow Docker's own repository and its release pace, the steps are on docs.docker.com. The commands below are the same with either.
2. Write the Compose file and the Caddyfile
Create a folder for the project. Compose names the volumes after it, so n8n gives you a volume called n8n_n8n_data, used again in the backup step.
mkdir ~/n8n && cd ~/n8nservices:
n8n:
image: n8nio/n8n:3.4.3
restart: unless-stopped
environment:
- N8N_HOST=n8n.example.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- N8N_WEBHOOK_URL=https://n8n.example.com/
- N8N_PROXY_HOPS=1
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- GENERIC_TIMEZONE=Europe/Paris
- TZ=Europe/Paris
volumes:
- n8n_data:/home/node/.n8n
caddy:
image: caddy:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
volumes:
n8n_data:
caddy_data:
caddy_config:n8n.example.com {
reverse_proxy n8n:5678
}Put your own domain in both files, and your time zone in place of Europe/Paris:
sed -i 's/n8n.example.com/n8n.yourdomain.com/g' compose.yaml CaddyfileA few choices worth knowing:
- n8n has no
ports:line. Only Caddy can reach it, over the private network Compose creates, so port 5678 is never open to the internet. N8N_PROXY_HOPS=1tells n8n that one proxy sits in front of it, so it reads the visitor's real IP from Caddy.N8N_WEBHOOK_URLgives your webhook nodes the public HTTPS address. Without it, n8n builds their address from the settings above and adds port 5678.- The version is pinned (
3.4.3). An update happens when you decide, not on the next restart.
3. Start n8n
docker compose up -d
docker compose logs caddy | grep -o "certificate obtained successfully"
docker compose logs n8n --no-log-prefix | grep -A1 "Editor is now"certificate obtained successfully
Editor is now accessible via:
https://n8n.example.comThe first start downloads the images (75 seconds on our server for the 1.92 GB of n8n), then n8n answers in about 20 seconds and Caddy gets its certificate a few seconds later. Open the address straight away and create the owner account: until that is done, whoever opens the page first can claim the instance, and every certificate is published in public logs, so a fresh domain gets visited quickly.
4. Update n8n without losing your workflows
Workflows, credentials, execution history and the encryption key all live in the n8n_data volume, not in the container. An update replaces the container and keeps the volume. Run the backup from step 5 first, then change the tag and restart. Here is the update we tested, from 3.3.0 to 3.4.3:
sed -i 's#n8nio/n8n:3.3.0#n8nio/n8n:3.4.3#' compose.yaml
docker compose pull n8n
docker compose up -d
docker compose exec n8n n8n --version
docker compose exec n8n n8n list:workflow3.4.3
NLnZabt5Q0JoKqkF|Guide test workflowThe download took 76 seconds while the old version kept running. The restart itself took 19 seconds. To see which versions exist, the n8nio/n8n page on Docker Hub lists them: on 3 December 2026, latest and stable pointed to 3.4.3, and next to 3.5.2. Read the release notes before changing the first number of the version.
5. Back up and restore
The script stops n8n for a few seconds so the SQLite database is copied in a clean state, archives the volume, starts n8n again and keeps 14 days of archives.
#!/bin/sh
# Daily n8n backup: stops n8n for a few seconds, archives the data volume, keeps 14 days.
cd "$(dirname "$0")"
mkdir -p backups
docker compose stop n8n
docker run --rm -v n8n_n8n_data:/data:ro -v "$PWD/backups":/backup alpine \
tar czf "/backup/n8n-data-$(date +%F).tar.gz" -C /data .
docker compose start n8n
find backups -name 'n8n-data-*.tar.gz' -mtime +14 -deletechmod +x backup.sh
./backup.sh
ls -lh backups/total 516K
-rw-r--r-- 1 root root 514K Dec 3 11:14 n8n-data-2026-12-03.tar.gzThe whole run took 4 seconds. The archive holds database.sqlite and the config file, which contains the key that decrypts your credentials: keep it as private as a password. To run it every night at 03:30, add this line with crontab -e:
30 3 * * * $HOME/n8n/backup.sh >> $HOME/n8n/backups/backup.log 2>&1To restore, we deleted the volume and rebuilt it from the archive. n8n was back 18 seconds later, with the same owner account and the same workflow:
docker compose down
docker volume rm n8n_n8n_data
docker volume create n8n_n8n_data
docker run --rm -v n8n_n8n_data:/data -v "$PWD/backups":/backup alpine \
sh -c "cd /data && tar xzf /backup/n8n-data-2026-12-03.tar.gz"
docker compose up -dAn archive kept on the same server does not survive the loss of the server: copy it elsewhere, or add the Daily backup option to your VPS (one copy every night, kept for 7 days). For workflows you want to track in Git, the CLI exports them as JSON:
docker compose exec n8n n8n export:workflow --all --pretty --output=/home/node/.n8n/workflows.json
docker compose cp n8n:/home/node/.n8n/workflows.json ./backups/What we ran into
WEBHOOK_URL is the old name. Older guides still set it, and so did our first run: n8n listed it among the deprecations at startup. Since n8n 2.35, the variable is N8N_WEBHOOK_URL (environment variables). With N8N_WEBHOOK_URL, one notice is left.
The task runner notices. Every start of n8n 3.4.3 prints these two messages:
Failed to start Python task runner in internal mode. because Python 3 is missing from this system. Launching a Python runner in internal mode is intended only for debugging and is not recommended for production. Users are encouraged to deploy in external mode. See: https://docs.n8n.io/hosting/configuration/task-runners/#setting-up-external-mode
There is a deprecation related to your n8n setup. Please take the recommended actions to update your configuration:
- N8N_RUNNERS_MODE -> Internal task runner mode is deprecated and will be removed in a future version. For isolation and scaling, run the task runner launcher as a separate process, set this variable to `external` and share `N8N_RUNNERS_AUTH_TOKEN` with the launcher. See https://docs.n8n.io/deploy/host-n8n/configure-n8n/set-up-task-runnersWorkflows run, and JavaScript in Code nodes runs inside the n8n container. Python in Code nodes does not: it needs the external runner that n8n describes in its task runners documentation, which n8n also plans to make the only mode.
The firewall does not see Docker's ports. Our test server had ufw active with only port 22 allowed, and Let's Encrypt still reached Caddy on ports 80 and 443. Docker writes its own firewall rules, ahead of ufw's. That is why n8n has no ports: line here: if you need port 5678 on the server itself, publish it as "127.0.0.1:5678:5678", never as "5678:5678".
Why Caddy and not Traefik. The Compose example in the n8n documentation uses Traefik, which needs access to the Docker socket. Caddy needs a three-line file, no access to Docker, and renews its certificates by itself.
n8n in one click on VPS-Minute
Prefer not to do it by hand? On our n8n VPS, pick n8n at the Configuration step of your order: it installs on the first boot, with HTTPS, and is ready about five minutes later. The 2 GB plan used in this guide costs €3.32 a month excluding VAT, in 9 locations, and Docker alone is also offered in one click on the Docker VPS.








