This guide takes a fresh 1 GB VPS to a working n8n: Docker, n8n with PostgreSQL in Docker Compose, a private way into the editor, the owner account, a first workflow, and nginx in front. Every command below is one we ran on 2026-09-29, and every number comes from that run's logs.
Tested on: Vultr 1 vCPU / 1 GB RAM / 25 GB SSD, Ubuntu 24.04.5 LTS, Docker 29.8.1, Docker Compose v5.5.1, n8n 2.40.7 (image n8nio/n8n), PostgreSQL 16.15. The longer write-up is Self-Host n8n on Vultr VPS: Docker + Nginx Setup Guide.
Not covered: pointing a real domain at the server, an HTTPS certificate, webhooks from outside services, backups, and upgrades. We tested nginx with a placeholder hostname only, so the domain and certificate steps aren't written up here yet.
1. Check what the server has
free -m
df -h /
Our fresh box reported 955 MB of memory with 640 MB available, a 2.3 GB swap file that Vultr's Ubuntu image already had, and 17 GB free on disk. Both numbers matter: n8n and PostgreSQL together sit near 350 MB at idle, and the two images take about 2.4 GB of disk.
2. Update the system and install Docker
apt-get update && apt-get upgrade -y
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
docker --version
docker compose version
The update and upgrade took 114 seconds and the Docker script 101 seconds. The script already installed the Compose plugin, so docker compose worked right away (v5.5.1); a separate apt install docker-compose-plugin reported it was already the newest version.
3. Write the settings file
Make a folder for n8n and put the secrets in a .env file next to the Compose file. This generates random values, so nothing secret is typed by hand:
mkdir -p ~/n8n && cd ~/n8n
cat > .env <<EOF
N8N_ENCRYPTION_KEY=$(openssl rand -hex 32)
POSTGRES_USER=n8n
POSTGRES_PASSWORD=$(openssl rand -hex 16)
POSTGRES_DB=n8n
GENERIC_TIMEZONE=America/New_York
EOF
N8N_ENCRYPTION_KEYencrypts the credentials you save in n8n. Keep a copy somewhere safe: if you move n8n to a new server without it, the saved credentials can't be read.- Change
GENERIC_TIMEZONEto yours. It decides when scheduled workflows fire.
4. Write the Compose file
services:
postgres:
image: postgres:16
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
n8n:
image: n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- N8N_PROXY_HOPS=1
- WEBHOOK_URL=https://n8n.yourdomain.com/
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_USER=${POSTGRES_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- postgres
volumes:
postgres_data:
n8n_data:
Save it as ~/n8n/docker-compose.yml. What the less obvious parts do:
127.0.0.1:5678:5678opens the editor on the server itself only. From the internet, a connection to port 5678 timed out in our test.N8N_HOST,N8N_PROTOCOLandWEBHOOK_URLdescribe the public address you'll use later behind nginx. Put your own hostname there now; we kept the placeholder because we had no domain on this box.- The two named volumes keep the database and n8n's settings when containers are removed or upgraded.
Check the file before starting anything:
docker compose config -q && echo "compose config valid"
5. Start n8n and PostgreSQL
docker compose up -d
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:5678/healthz
Give it time. On our box docker compose up -d took 256 seconds, most of it downloading the images. /healthz returned 200 another 43 seconds later, while n8n set up its tables in PostgreSQL; docker compose logs n8n shows a long run of "Starting migration" lines during that time. Until then the health check keeps failing, so wait before assuming something is broken.
The images were 1.73 GB (n8nio/n8n) and 642 MB (postgres:16), and disk use went from 6.4 GB to 8.7 GB. The log also printed "Failed to start Python task runner", because the image has no Python. JavaScript Code nodes still ran.
6. Check the firewall
ufw status verbose
Vultr's Ubuntu 24.04 image already had ufw active, denying incoming traffic except SSH. Open the web ports now so nginx can serve n8n later:
ufw allow 80
ufw allow 443
If ufw isn't active on your server, ufw enable asks "Command may disrupt existing ssh connections. Proceed with operation (y|n)?". Make sure 22 is allowed first, then answer y. In a script with no keyboard, the prompt aborts.
7. Open the editor through an SSH tunnel
Run this on your own computer, not on the server:
ssh -L 5678:127.0.0.1:5678 root@YOUR_SERVER_IP
Leave it open and go to http://localhost:5678. Even with N8N_PROTOCOL=https set, the editor loaded over the tunnel without a secure-cookie error.
8. Create the owner account
The first page asks for Email, First Name, Last Name and Password. The password needs at least 8 characters, a number and a capital letter. After it, n8n showed a short "Customize n8n to you" survey and then a "Get paid features for free (forever)" license-key offer, which has a Skip button.
9. Run a first workflow
Our test workflow was three nodes: a Manual Trigger, an HTTP Request that fetched 5,000 records from the public JSONPlaceholder test API, and a Code node that went through all 5,000. Click "Execute workflow" to run it. It finished in 4.1 seconds, and the canvas showed 1 item, then 5,000, then 5,000.
One thing that tripped us: new URL(...) in the Code node failed with "URL is not defined". Splitting the string by hand worked.
During that run n8n peaked at about 458 MiB, and the server still had 133 MB available.
10. Put nginx in front
apt-get install -y nginx
Create /etc/nginx/sites-available/n8n with your hostname in place of the placeholder:
server {
listen 80;
server_name n8n.yourdomain.com;
client_max_body_size 50M;
location / {
proxy_pass http://127.0.0.1:5678;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
}
The Upgrade and Connection lines pass through the WebSocket the editor uses. Turn the site on and test it from the server:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
curl -s -H 'Host: n8n.yourdomain.com' http://127.0.0.1/healthz
Our very first request right after the reload returned 404. A few seconds later the same request returned {"status":"ok"}, and / returned 200. If you see a 404, wait a moment and try again before changing the config.
From here you still need DNS for your hostname and a certificate for HTTPS, which this guide doesn't cover.
11. Check memory, and know the limit
docker stats --no-stream
free -m
After a restart with no browser open, n8n used about 315 MiB and PostgreSQL about 38 MiB, with 277 MB available and 150 MB in swap. That leaves room for normal workflows, not for big ones.
We pushed it with a Code node that built 100,000 items of 1,000 characters each. n8n climbed to 599 MiB, available memory fell to 60 MB, and swap use reached 827 MB. The kernel killed nothing and neither container restarted, but the run failed after about 76 seconds with "Query runner already released", and the log filled with "timeout exceeded when trying to connect" from the database pool. On 1 GB, keep a single run's data in the thousands of items, not hundreds of thousands, or move to 2 GB.
What's next
- Which Vultr plan to pick and the full memory numbers: Self-Host n8n on Vultr VPS.
- Whether self-hosting beats paying per task: Self-Hosted n8n vs Zapier: Real Cost Breakdown.
- Another app with the same tunnel setup: How to Self-Host Uptime Kuma on a 1 GB VPS.