Some links on this page are affiliate links: if you sign up through them I may earn a commission, at no extra cost to you.
Contabo Black Friday · November 23–30
VPS Plus 2 (2 vCPU, 4 GB of RAM, 75 GB NVMe) from €7.20/month excl. VAT with a 24-month term. On sale until November 30.
Short answer: order a Cloud VPS with Ubuntu, allow only ports 22, 80 and 443 in Contabo’s firewall, install Docker from the official repository and start n8n, PostgreSQL and Traefik with one compose.yaml. Traefik gets the HTTPS certificate on its own, and GENERIC_TIMEZONE keeps schedules in your time zone.
Before ordering, compare providers in how much it costs to host n8n. Current plans and prices are on Contabo’s site: see Contabo plansaffiliate.
Contabo Black Friday · November 23–30
VPS Plus 2: 2 vCPU, 4 GB of RAM and 75 GB NVMe
From €7.20/month (excl. VAT) with a 24-month term. It is the entry plan of Contabo’s Performance VPS line and is on sale until Monday, November 30. 4 GB is the size the calculator suggests for n8n with PostgreSQL under moderate use.
Recommended VPS
Contabo Cloud VPS 4 (4 vCPU, 8 GB of RAM and 100 GB of SSD) leaves room for n8n, PostgreSQL and a reverse proxy on one server. It starts at $5.28/month for the first 24 months (EU region, checked on November 30, 2026); other regions cost extra.
Pick the plan, region and image
On the plan page, the order goes through these steps:
- Plan: Cloud VPS 4 has 4 vCPU, 8 GB of RAM and 100 GB of SSD, which leaves room for n8n, PostgreSQL and Traefik together. To size it, see how much RAM and CPU n8n needs.
- Term length: 1, 12 or 24 months.
- Region: under the Europe, America, Asia and Australia tabs. The European Union has no surcharge; the United Kingdom and the three United States regions (East, Central and West) add a monthly surcharge, shown in the order form. The full list is on Contabo’s locations page. Pick the one closest to you and the services your workflows call.
- Image: under OS, pick Ubuntu. The Apps tab has a ready-made n8n image, but this guide starts from plain Ubuntu so you control the version, the database and the proxy.
- Data Protection: Auto Backup is a paid add-on, with a daily copy and the last 10 versions kept. It is optional; step 9 covers the database backup.
- Login & password: the user is
root. Generate or set a strong password and keep it in a password manager: Contabo does not email it to you.
Log in over SSH for the first time
Once payment clears, Contabo builds the server and sends an email with the subject “Your login data!”, with the IP address and the user name. To track the order (email and order ID), follow Contabo’s official order status instructions.
From a terminal on your computer (on Windows, PowerShell already includes ssh):
ssh root@SERVER_IP
On the first connection, accept the host key fingerprint with yes and type the password from the order (nothing shows while you type). Contabo’s first connection guide has the details. If you lose the password, reset it in the customer panel under Servers & Hosting, three-dot menu, Reset credentials (instructions).
On the server, update the system:
apt update && apt upgrade -y
Switch from password to SSH key
On your computer, create a key (if you don’t have one) and copy the public part to the server:
ssh-keygen -t ed25519
ssh-copy-id root@SERVER_IP
Windows has no ssh-copy-id, so use this in PowerShell:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@SERVER_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Open another terminal and check that ssh root@SERVER_IP logs in without a password. Only then turn off password logins, on the server:
printf 'PasswordAuthentication no\nPermitRootLogin prohibit-password\n' > /etc/ssh/sshd_config.d/01-hardening.conf
sshd -t && systemctl reload ssh
sshd -T | grep -E '^(passwordauthentication|permitrootlogin)'
The file name starts with 01 because in sshd_config the first value read for each option wins, and the files in that folder are read in alphabetical order (sshd_config manual). The last command must show passwordauthentication no and, for permitrootlogin, prohibit-password (older OpenSSH versions print without-password, the old name for the same setting). Keep the old terminal open until a new login works.
Turn on Contabo’s firewall
Contabo’s firewall is free and filters incoming traffic before it reaches the VPS. Use it instead of UFW: according to the Docker documentation, ports published by containers bypass UFW rules.
In the customer panel, under Network Services > Firewall:
- Create a firewall.
- Add inbound TCP rules for SSH (22), HTTP (80) and HTTPS (443), with source Any. Ports 80 and 443 serve the certificate challenge and n8n itself.
- On the Active VPS/VDS tab, assign the firewall to your VPS.
Details are in Contabo’s firewall documentation.
Install Docker
Use Docker’s official repository, as in the Ubuntu install guide. The convenience script is not recommended for production.
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Check with docker --version and docker compose version.
Point the subdomain at the VPS
In your domain’s DNS, create an A record for n8n pointing to the VPS IP. The certificate is only issued once the name resolves to the server, so wait for DNS before step 8.
Create the .env and compose.yaml
mkdir -p ~/n8n-compose/local-files && cd ~/n8n-compose
openssl rand -hex 32
openssl generates n8n’s encryption key. Create .env with it, a strong database password and your details. GENERIC_TIMEZONE takes a time zone name from the tz database, such as America/New_York or Europe/Berlin:
DOMAIN_NAME=yourdomain.com
SUBDOMAIN=n8n
GENERIC_TIMEZONE=America/New_York
SSL_EMAIL=you@yourdomain.com
POSTGRES_USER=n8n
POSTGRES_PASSWORD=change-to-a-strong-password
POSTGRES_DB=n8n
N8N_ENCRYPTION_KEY=paste-the-generated-key
Lock the file down with chmod 600 .env. Then create compose.yaml:
services:
traefik:
image: "traefik"
restart: always
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- traefik_data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
postgres:
image: postgres:18
restart: always
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- PGDATA=/var/lib/postgresql/data
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
n8n:
image: n8nio/n8n:stable
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n@docker
environment:
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- N8N_WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- TZ=${GENERIC_TIMEZONE}
- N8N_RESTRICT_FILE_ACCESS_TO=/files
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
depends_on:
postgres:
condition: service_healthy
volumes:
db_data:
n8n_data:
traefik_data:
It combines the Traefik example from the n8n documentation with the PostgreSQL setup from n8n with Docker Compose and PostgreSQL:
- the image uses the
stabletag, becauselatestcan point to a beta; - PostgreSQL publishes no port and n8n only listens on
127.0.0.1; Traefik is the only thing facing the internet; - n8n only starts after the database answers
pg_isready; GENERIC_TIMEZONEandTZshare the same zone, so the Schedule node and the log times match your clock.
Start n8n and check it
docker compose up -d
docker compose ps
docker compose logs n8n --tail 20
The end of the log shows Editor is now accessible via: https://n8n.yourdomain.com. To confirm n8n created its tables in PostgreSQL and the time zone is right:
docker compose exec postgres psql -U n8n -d n8n -c '\dt'
docker compose exec n8n date
date should print your local time. Open https://n8n.yourdomain.com and create the owner account. If the browser reports an invalid certificate, check docker compose logs traefik: usually DNS doesn’t point at the VPS yet or port 443 is closed in the firewall.
Set up backups
Dump the database and copy it out of the container:
docker compose exec -T postgres pg_dump -U n8n -d n8n -Fc -f /tmp/n8n.dump
docker compose cp postgres:/tmp/n8n.dump ./n8n-$(date +%F).dump
Move the file off the VPS and keep .env somewhere safe.
Restoring, CLI exports and scheduling are covered in the n8n backup guide. Contabo’s Auto Backup and snapshots add to the dump, but they don’t replace a copy kept outside the provider.
Next steps
- Update n8n with a backup first and the right tag.
- Check that your version is above the minimum safe n8n version.
- If executions grow, see n8n in queue mode with Redis and workers.
- If the webhook shows
localhost:5678or the editor says Connection lost, see common self-hosted n8n errors.
VPS calculator
Not sure how much RAM and CPU to plan for? Enter your executions per day, database and whether you use queue mode: the calculator estimates RAM and vCPUs and lists the plans that fit.
Frequently asked questions
Which Contabo plan should I use for n8n?
Cloud VPS 4, with 4 vCPU, 8 GB of RAM and 100 GB of SSD, leaves room for n8n, PostgreSQL and Traefik together.
Why use Contabo’s firewall instead of UFW?
Because ports published by Docker containers bypass UFW rules. Contabo’s firewall is free and filters traffic before it reaches the VPS.
Does Contabo email the server password?
No. The Your login data! email has the IP address and the user name; the password is the one you set in the order. If you lose it, use Reset credentials in the customer panel.