How to Install n8n on CyberPanel Using Docker (Complete Step-by-Step Guide)

Self-hosting n8n on your own VPS gives you unlimited workflow executions, full data privacy, and custom webhook endpoints at a fraction of cloud pricing. In this step-by-step guide, you will install n8n on a CyberPanel server using Docker and reverse-proxy it behind OpenLiteSpeed with automatic Let’s Encrypt SSL.
Prerequisites
- An Ubuntu 22.04 or 24.04 VPS with CyberPanel installed (minimum 2 GB RAM).
- A domain or subdomain (for example,
n8n.yourdomain.com) pointed to your server IP. - Root SSH access to your server.
Step 1: Create a Website in CyberPanel & Issue SSL
- Log into your CyberPanel dashboard and navigate to Websites → Create Website.
- Enter your subdomain (e.g.,
n8n.yourdomain.com), select PHP 8.1+, and check SSL. - Once created, go to SSL → Manage SSL to verify that a valid Let’s Encrypt certificate is active.
Step 2: Install Docker & Docker Compose
Connect to your server via SSH and install Docker if it is not already installed:
sudo apt update && sudo apt install -y docker.io docker-compose-v2
sudo systemctl enable --now dockerStep 3: Create the n8n Docker Compose Configuration
Create a dedicated directory for your n8n data and configuration:
mkdir -p /opt/n8n && cd /opt/n8n
nano docker-compose.ymlPaste the following docker-compose.yml configuration, replacing n8n.yourdomain.com with your actual domain:
services:
n8n:
image: docker.n8n.io/n8nio/n8n:latest
restart: always
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.yourdomain.com/
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:Start the container in detached mode:
docker compose up -dStep 4: Configure OpenLiteSpeed Reverse Proxy in CyberPanel
In CyberPanel, go to Websites → List Websites → Manage next to your n8n domain, click vHost Conf, and add the external application and rewrite proxy rules so OpenLiteSpeed forwards HTTPS traffic (including WebSockets) to 127.0.0.1:5678:
extprocessor n8n_docker {
type proxy
address 127.0.0.1:5678
maxConns 100
pcKeepAliveTimeout 60
initTimeout 60
retryTimeout 0
respBuffer 0
}
rewrite {
enable 1
autoLoadHtaccess 1
RewriteRule ^(.*)$ HTTP://n8n_docker/$1 [P,L]
}Step 5: Complete Your n8n Owner Setup
Restart OpenLiteSpeed from CyberPanel (systemctl restart lsws), then visit https://n8n.yourdomain.com in your browser to create your owner account and build your first automated workflow!






Reader Discussion
0 Comments