n8n is an open-source workflow automation platform that lets you connect apps, trigger workflows, and process data visually all without writing complex scripts.
It’s perfect for automating tasks like sending emails, syncing spreadsheets, managing leads, and more.
Typically, n8n is installed directly on a VPS (Virtual Private Server) using Node.js or Docker.
However, if you’ve already installed CyberPanel, which runs on OpenLiteSpeed, installing n8n directly can cause conflicts with ports and existing web server configurations.
Here’s the workaround: Instead of installing n8n directly on your server, you can run it inside a Docker container.
Docker creates an isolated environment that bypasses CyberPanel’s constraints, allowing you to host n8n side-by-side without interfering with other websites or services.
With this method, you still benefit from CyberPanel’s tools (like reverse proxy, SSL, and domain management), while keeping your n8n instance clean, secure, and easy to manage.
In short:
✔ You get n8n automation power
✔ You use CyberPanel’s web control features
✔ You avoid conflicts and port issues by containerizing n8n
In this guide, you’ll learn how to install n8n inside a Docker container and securely serve it through a subdomain managed by CyberPanel.
Step 1: Prerequisites and Server Preparation
Before jumping into the installation, make sure you meet the following:
✅ Requirements
- A VPS or dedicated server (Ubuntu/Debian recommended)
- CyberPanel installed and working
- Domain or subdomain pointed to your server
- Ports 80 and 443 open
- Root or sudo access via SSH
Step 2: Install Docker and Docker Compose
Log in to your server and update packages:
sudo apt update && sudo apt upgrade -yThen install Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.shAdd your user to the Docker group (optional):
sudo usermod -aG docker $USERInstall Docker Compose:
sudo apt install docker-compose -yVerify installation:
docker --version
docker-compose --versionStep 3: Create a Subdomain in CyberPanel
- Log in to CyberPanel
- Go to Websites → Create Website
- Enter your subdomain (e.g.,
n8n.yourdomain.com) - Enable SSL (Let’s Encrypt)
- Click Create Website
Wait a few seconds and verify the domain works by visiting it in your browser.
Step 4: Set Up Docker for n8n
Create Docker Volume for Data Persistence
docker volume create n8n_data🛠️ Define Environment Variables
These are key to secure and functional operation. You can pass them directly or use a .env file. Key ones include:
N8N_HOST=n8n.yourdomain.com
N8N_PROTOCOL=https
WEBHOOK_URL=https://n8n.yourdomain.com/
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=StrongPasswordStep 5: Launch n8n in Docker
Option 1: Use docker run
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
-e N8N_HOST="n8n.yourdomain.com" \
-e N8N_PROTOCOL="https" \
-e WEBHOOK_URL="https://n8n.yourdomain.com/" \
-e N8N_BASIC_AUTH_ACTIVE="true" \
-e N8N_BASIC_AUTH_USER="admin" \
-e N8N_BASIC_AUTH_PASSWORD="StrongPassword" \
--restart unless-stopped \
n8nio/n8nOption 2: Use Docker Compose (Recommended)
Create a file called docker-compose.yml:
version: '3'
services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.yourdomain.com/
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=StrongPassword
volumes:
n8n_data:Run:
docker-compose up -dStep 6: Configure Reverse Proxy in CyberPanel
CyberPanel uses OpenLiteSpeed. You’ll configure it to forward web requests to your n8n Docker container.
6.1 Add External Processor
Edit OpenLiteSpeed’s configuration file:
sudo nano /usr/local/lsws/conf/httpd_config.xmlAdd:
extprocessor myn8ndocker {
type proxy
address 127.0.0.1:5678
maxConns 100
initTimeout 60
retryTimeout 0
respBuffer 0
}6.2 Configure vHost Rewrite Rules
Go to CyberPanel → Websites → List Websites → Manage → vHost Conf
For HTTP (port 80):
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
RewriteRule ^(.*)$ http://myn8ndocker/$1 [P,L]For HTTPS (port 443):
RewriteEngine On
RewriteRule ^(.*)$ http://myn8ndocker/$1 [P,L]Restart OpenLiteSpeed:
sudo service lsws restartStep 7: Verify Installation
Visit:
https://n8n.yourdomain.comYou should see the n8n interface.
Test:
- Logging in with your credentials
- Creating a simple workflow
- Accessing webhook URLs
Step 8: Troubleshooting Tips
| Issue | Solution |
|---|---|
| “Connection Lost” error | Ensure N8N_PROTOCOL is https, reverse proxy OK |
| SSL not working | Check DNS and Let’s Encrypt status |
| Volume not saving data | Verify n8n_data is used in Docker config |
| Cannot access web interface | Confirm firewall ports and reverse proxy settings |
| Need to update n8n | Pull new image and restart container |
Best Practices
- Use basic auth or firewall rules to protect your n8n instance
- Regularly backup your Docker volumes
- Avoid exposing port
5678directly to the internet - Use a fixed version tag instead of
latestin production - Monitor logs:
docker logs n8n
Conclusion
You’ve now successfully installed and configured n8n on CyberPanel using Docker, secured it with SSL, and made it accessible via a custom subdomain.
This setup is scalable, secure, and easy to maintain. You’re ready to start building powerful automations!

Leave a Reply