How do I install n8n on my VPS?
Deploy n8n with Docker Compose, persistent storage and domain-specific variables. The preconfigured n8n solution is available at no extra cost.
The preconfigured n8n solution is available at no extra cost. Select it during ordering for automatic installation, or use this guide for a manual setup on Debian.
Step-by-step procedure
-
Choose the deployment mode
Select preconfigured n8n for automatic installation, or choose a Linux VPS with enough RAM for a manual installation.
-
Install Docker
Follow the Docker guide and check docker compose version.
-
Create the project
Create /opt/n8n, add the Compose file then replace the domain and timezone.
-
Start
Run docker compose up -d and check the logs with docker compose logs -f n8n.
-
Add HTTPS
Put Caddy or Nginx in front of port 5678 and do not expose the n8n interface directly over public HTTP.
compose.yaml
services:
n8n:
image: docker.n8n.io/n8nio/n8n:latest
restart: unless-stopped
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=n8n.example.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.example.com/
- GENERIC_TIMEZONE=Europe/Paris
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Update n8n
cd /opt/n8n
docker compose pull
docker compose up -d
docker image prune -f
Before you start
n8n keeps its workflows, its encrypted credentials and its encryption key in /home/node/.n8n, mounted here on the n8n_data volume. Without this volume, everything is lost when the container is recreated.
- A Linux VPS with at least 2 GB of RAM, the minimum required by the preconfigured n8n application.
- A domain whose DNS you manage, with an A record pointing to the VPS IPv4, to get HTTPS.
- The port published on 127.0.0.1:5678 only, as in the Compose file: only the reverse proxy reaches it.
The preconfigured installation in detail
The preconfigured n8n application starts from Debian 12. It asks for the n8n owner email and password (8 characters minimum), an optional domain, the port (5678 by default) and the time zone (Europe/Paris by default). If you leave the domain empty, a free aclclouds.online subdomain is created with automatic HTTPS.
The script installs Docker, starts a container named n8n on the n8n_data volume and configures Caddy in /etc/caddy/Caddyfile. The owner account is already created: sign in with the email and password you entered. On an existing VPS, this application is chosen in “Reinstalls”, option “Preconfigured application”, which wipes the disk.
Check that everything works
docker compose ps must show the n8n service with an Up status, and curl -s http://127.0.0.1:5678/healthz must return {"status":"ok"}. In the logs, the line Editor is now accessible via: confirms that the editor is ready.
Frequently asked questions
Why does n8n show EACCES: permission denied, open '/home/node/.n8n/config'?
You mounted a VPS directory instead of the named volume, and that directory belongs to root. n8n runs as the node user (UID 1000). Give it the directory with chown -R 1000:1000 /opt/n8n/data, or go back to the n8n_data volume.
What should I do if the container keeps restarting with Exit code 137?
The system stopped n8n because it ran out of memory. Check with free -h and dmesg | grep -i oom. Limit heavy executions running in parallel, stop other unneeded containers or move to a plan with more RAM.
Why does sign-in fail with a message about a secure cookie?
By default n8n sends a cookie restricted to HTTPS. If you open an http:// address in the browser, n8n shows Your n8n server is configured to use a secure cookie and refuses the sign-in. Finish the HTTPS setup, then open the domain with https:// in the browser. Keep N8N_SECURE_COOKIE=false for local tests only.
How do I change the domain later?
Create the A record for the new domain, change N8N_HOST and WEBHOOK_URL in compose.yaml, then the name in the Caddyfile. Apply with docker compose up -d and systemctl reload caddy. External applications must then use the new webhook URLs.