Hosting n8n automation workflows on a Linux VPS gives you control over schedules, webhooks, credentials, and integrations. You can automate order alerts, lead routing, and data updates without relying on a shared hosting environment. This guide uses Docker Compose on Ubuntu as a practical starting point.
Why Host n8n Automation Workflows on a Linux VPS?
A VPS runs your workflows on an always-available server. It also lets you manage updates, data storage, and network access. Choose a plan with enough resources for your workload. Around 2 vCPU and 4 GB RAM is a comfortable starting point for small installations, not a universal minimum.
CybroHost Linux VPS Hosting offers KVM resources, NVMe storage, and root access for self-managed applications.
Step 1: Prepare Your VPS and Domain
Install a supported Ubuntu release and connect using SSH. Update the operating system, then install Docker Engine and the Docker Compose plugin. Verify that Compose works:
sudo apt update && sudo apt upgrade -y
sudo docker compose version
The second command requires Docker Compose to be installed already. Point an A record for n8n.example.com to your VPS IP. Keep SSH access restricted and allow HTTPS traffic.
Step 2: Create Your n8n Docker Compose File
Create a directory and open a new Compose file:
mkdir -p ~/n8n && cd ~/n8n
nano compose.yaml
Paste this basic configuration, replacing the example hostname:
services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=n8n.example.com
- N8N_PROTOCOL=https
- N8N_EDITOR_BASE_URL=https://n8n.example.com/
- N8N_WEBHOOK_URL=https://n8n.example.com/
- N8N_PROXY_HOPS=1
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- GENERIC_TIMEZONE=Etc/UTC
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
The named volume preserves workflows, credentials, and the encryption key across container replacements. For production, pin a tested image version rather than relying on an unpinned tag.
Step 3: Start n8n and Enable HTTPS
Launch the service and inspect its logs:
sudo docker compose up -d
sudo docker compose logs --tail=50 n8n
Port 5678 now listens only on localhost. Install Caddy on the VPS, allow inbound ports 80 and 443, then add this to /etc/caddy/Caddyfile:
n8n.example.com {
reverse_proxy 127.0.0.1:5678
}
Reload Caddy with sudo systemctl reload caddy. With working DNS, Caddy can obtain a TLS certificate and serve n8n securely over HTTPS.
Follow the official n8n Docker Compose guidance for a full proxy setup. Do not expose port 5678 directly to the internet.
Step 4: Create and Test Your First Workflow
Open the HTTPS address and create your owner account. Add a Schedule Trigger or Webhook node, then connect an action such as an email or HTTP request. Run a test, inspect the execution result, and activate the workflow only after it succeeds.
Step 5: Secure, Back Up, and Monitor n8n
Use strong login credentials and two-factor authentication where available. Back up the persistent Docker volume and any external database. Keep the encryption key recoverable. Review logs, update images after testing, and watch RAM, disk space, and failed executions. For busier production workloads, consider PostgreSQL.
FAQs
Can n8n run on a 1 GB VPS?
Very small experiments may run, but memory can become tight. Choose more RAM for multiple workflows, integrations, or frequent executions.
Do I need a domain for n8n?
Not for local testing. However, a domain and HTTPS are strongly recommended for secure remote access and public webhooks.
Can I host n8n and WordPress on one VPS?
Yes, if CPU, RAM, ports, and reverse-proxy routing are planned carefully. Isolate services and monitor their combined resource use.
Final Recommendation
Start with Docker Compose, persistent storage, and HTTPS. Test one workflow before adding more, then scale your VPS and database as automation demand grows.
