n8n is an automation tool where you connect applications and services into workflows by dragging blocks: for example, a new order creates an invoice, sends a Slack message and saves the data to a spreadsheet. On your own VPS you don't pay per execution and your data stays with you.
For maximum stability, we recommend installing it on a Hukot.net VPS: your server is ready within 60 seconds of ordering and your data stays in a data centre in the Czech Republic.
Prerequisites #
- A VPS with Ubuntu 22.04 / 24.04 / 26.04 LTS or Debian 12 / 13 and SSH access with
sudorights. - At least 4 GB of RAM (the VPS-L04G tariff). When your workflows grow and memory runs short, you can switch to a higher tariff right in the administration and pay only the difference.
- A domain or subdomain for n8n (for example
n8n.example.com) whoseArecord points to the server's IP address. You can set the record by following How to edit DNS.
n8n reachable from the internet must run over HTTPS. That's why this guide uses Nginx and a Let's Encrypt certificate.
Installation #
Configuration
-
Create a directory for n8n:
sudo mkdir -p /opt/n8n cd /opt/n8n -
Create a
.envfile with the domain, the time zone and randomly generated passwords:sudo tee .env > /dev/null <<EOF N8N_DOMAIN=<domain> GENERIC_TIMEZONE=Europe/Prague POSTGRES_PASSWORD=$(openssl rand -hex 24) N8N_ENCRYPTION_KEY=$(openssl rand -hex 32) EOF sudo chmod 600 .envReplace
<domain>with the domain for n8n, for examplen8n.example.com, andEurope/Praguewith your time zone if it differs.n8n uses
N8N_ENCRYPTION_KEYto encrypt the credentials for other services. Without it, you can't decrypt them after restoring from a backup. Back up the.envfile in a safe place. -
Create the
compose.yamlfile:sudo nano compose.yamlservices: postgres: image: postgres:17 restart: unless-stopped environment: POSTGRES_USER: n8n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: n8n volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"] interval: 10s timeout: 5s retries: 5 n8n: image: n8nio/n8n restart: unless-stopped ports: - "127.0.0.1:5678:5678" environment: DB_TYPE: postgresdb DB_POSTGRESDB_HOST: postgres DB_POSTGRESDB_PORT: "5432" DB_POSTGRESDB_DATABASE: n8n DB_POSTGRESDB_USER: n8n DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD} N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY} N8N_HOST: ${N8N_DOMAIN} N8N_PORT: "5678" N8N_PROTOCOL: https N8N_WEBHOOK_URL: https://${N8N_DOMAIN}/ N8N_PROXY_HOPS: "1" N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true" NODE_ENV: production GENERIC_TIMEZONE: ${GENERIC_TIMEZONE} TZ: ${GENERIC_TIMEZONE} volumes: - n8n_data:/home/node/.n8n depends_on: postgres: condition: service_healthy volumes: postgres_data: n8n_data:The n8n port is published only on
127.0.0.1because Docker bypasses the UFW firewall. The database publishes no port at all; n8n connects to it inside the Docker network.
Starting n8n
-
Pull the images and start n8n in the background:
sudo docker compose up -d -
Check that both containers are running.
postgresshould show the statushealthy:sudo docker compose ps -
Look at the n8n log. After the first start it contains the message
Editor is now accessible via:sudo docker compose logs -f n8nThe first start takes a minute or two while n8n prepares the database. Stop following the log with Ctrl + C.
Nginx and HTTPS
-
Install Nginx and Certbot and allow HTTP and HTTPS in the firewall:
sudo apt install -y nginx certbot python3-certbot-nginx sudo ufw allow 'Nginx Full' -
The n8n editor talks to the browser over WebSocket. Enable WebSocket support in
/etc/nginx/conf.d/websocket.conf:sudo nano /etc/nginx/conf.d/websocket.confmap $http_upgrade $connection_upgrade { default upgrade; '' close; } -
Create the file
/etc/nginx/sites-available/n8n:sudo nano /etc/nginx/sites-available/n8nserver { listen 80; listen [::]:80; server_name <domain>; client_max_body_size 50M; location / { proxy_pass http://127.0.0.1:5678; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; 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-Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 300s; } }Replace
<domain>with the same domain as in the.envfile. -
Enable the site and issue the certificate:
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx sudo certbot --nginx -d <domain>
First login #
- Open
https://<domain>in your browser. - Fill in the Set up owner account form. This account owns the instance and has all permissions, so do it right after the start.
- Invite other users in Settings → Users.
Connecting your own model in Ollama #
If you don't want to send data to OpenAI or another cloud AI, use your own language model in n8n. It runs on a Hukot.net GPU-VPS with 24 to 96 GB of VRAM and you don't pay for tokens.
Ollama listens only on 127.0.0.1, which the n8n container can't reach. It therefore has to listen on all addresses, and the firewall has to protect it from the internet.
This setup is safe only with the UFW firewall enabled. The Ollama API has no login, and without a firewall anyone on the internet could use your graphics card. Enable the firewall by following Setting up a firewall with UFW.
-
Check that UFW is enabled. The output should say
Status: active:sudo ufw status -
Allow access to Ollama only from Docker containers:
sudo ufw allow from 172.16.0.0/12 to 172.17.0.1 port 11434 proto tcp172.17.0.1is the server's address in the Docker network, which containers reach throughhost.docker.internal. The rule therefore doesn't open access on the server's public IP address. -
Make Ollama listen on all addresses:
sudo systemctl edit ollamaPaste into the opened file:
[Service] Environment="OLLAMA_HOST=0.0.0.0:11434"Save the file and restart Ollama:
sudo systemctl restart ollama -
In
/opt/n8n/compose.yaml, add the host address to then8nservice, at the same level asports:extra_hosts: - "host.docker.internal:host-gateway"Apply the change:
cd /opt/n8n sudo docker compose up -d -
From your own computer, check that Ollama isn't reachable from outside. The command should fail or time out:
curl -m 5 http://<server-ip>:11434Replace
<server-ip>with the server's IP address. -
In n8n, create Ollama credentials and enter
http://host.docker.internal:11434as the Base URL. Then use the model in the Ollama Chat Model or AI Agent nodes.
Backups #
All n8n data is in the PostgreSQL database, and the key to the credentials is in the .env file. Back up the database to a file:
cd /opt/n8n
sudo docker compose exec -T postgres pg_dump -U n8n n8n | sudo tee /root/n8n-$(date +%F).sql > /dev/null
Store the backup and the .env file outside the server.
Updates #
n8n releases new versions every week. Update it by pulling the new image:
cd /opt/n8n
sudo docker compose pull
sudo docker compose up -d
Before a bigger update, create a snapshot in the Hukot.net VPS administration. If anything breaks after the update, you can roll the server back to its previous state.
The postgres:17 image stays on major version 17 and receives only fixes. Moving to a new major PostgreSQL version requires converting the data, so don't change the version number without a backup.
Why choose our VPS? #
Unlike public clouds, we guarantee that your data stays in the Czech Republic, with top-class connectivity. Your n8n automations process customer data on a server in the Czech Republic and run non-stop with no limit on executions.
Want automation without limits? #
Order a VPS from Hukot.net and run your first n8n workflow today.