In this guide, I’m going to show you exactly how I installed n8n on my server running CyberPanel, using Docker. I’ll explain everything like you’re doing it for the first time—every little step, even things that might seem basic.
You need to already have CyberPanel installed. If you don’t, check CyberPanel’s installation guide first.
What is n8n and Why I Used Docker
n8n is a tool that lets you connect different apps together and automate stuff. Think Zapier, but you control everything yourself, and it’s free if you host it.
I used Docker because:
- It keeps n8n isolated, so it doesn’t mess up my server.
- It’s super easy to update or move later.
- It saves time—no installing Node.js or worrying about system dependencies.
- I can back it up easily with Docker volumes.
How I Installed Docker on Ubuntu
I needed Docker first. Here’s how I did it:
- Updated my package list: sudo apt-get update
- Installed Docker: sudo apt-get install -y docker.io
- Made sure Docker runs on startup: sudo systemctl start docker
sudo systemctl enable docker - (Optional but nice) Allowed my user to run Docker commands without sudo: sudo usermod -aG docker $USER (After that, I logged out and back in.)
- Checked if Docker was working: docker –version
Setting Up My Subdomain in CyberPanel
Next, I needed a domain to open n8n from my browser.
- Logged into CyberPanel (
https://my-server-ip:8090
). - Created a new website:
- Went to Websites → Create Website.
- Entered my subdomain, like
n8n.mywebsite.com
. - Chose my package and owner.
- Checked SSL for a free Let’s Encrypt certificate.
- Hit Create Website.
CyberPanel took care of setting up the subdomain for me.
Running n8n Inside a Docker Container
Once my subdomain was ready, it was time to run n8n.
- Opened my SSH terminal (I used the Terminal app, but you can use PuTTY or whatever you like).
- Created a Docker volume to save data: docker volume create n8n_data
- Ran n8n using this command (all on one line): ServerName n8n.mywebsite.com DocumentRoot /home/n8n.mywebsite.com/public_html RewriteEngine On RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/ RewriteRule ^(.*)$ http://myn8ndocker/$1 [P,L]
Quick breakdown of what that does:
- Makes n8n run in the background.
- Only listens on localhost (127.0.0.1), not directly open to the internet.
- Saves data in the volume called
n8n_data
. - Sets up environment variables so n8n knows what domain it’s running under.
- Forces n8n to use SSE (Server Sent Events) to avoid that annoying “Connection Lost” error.
Setting Up the Reverse Proxy on CyberPanel
Since n8n runs only on localhost, I had to tell LiteSpeed (the web server CyberPanel uses) to forward my subdomain’s traffic to the Docker container.
A. Creating an External Processor
- Logged into my server again via SSH.
- Edited LiteSpeed’s main config file: sudo nano /usr/local/lsws/conf/httpd_config.xml
- Scrolled to the bottom and added this block: myn8ndocker proxy http://127.0.0.1:5678 100 60 60 0 0
- Saved and exited:
- Pressed Ctrl+O, then Enter, then Ctrl+X.
B. Setting Up Rewrite Rules
- Went into CyberPanel → Websites → List Websites → Manage → vHost Conf.
- Edited my Virtual Host config to add this for HTTP (port 80): ServerName n8n.mywebsite.com DocumentRoot /home/n8n.mywebsite.com/public_html RewriteEngine On RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/ RewriteRule ^(.*)$ http://myn8ndocker/$1 [P,L]
- And this for HTTPS (port 443): ServerName n8n.mywebsite.com DocumentRoot /home/n8n.mywebsite.com/public_html RewriteEngine On RewriteRule ^(.*)$ http://myn8ndocker/$1 [P,L] SSLEngine on SSLCertificateFile /etc/letsencrypt/live/n8n.mywebsite.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/n8n.mywebsite.com/privkey.pem
- Saved and restarted LiteSpeed:
- Either through CyberPanel or by SSH: sudo service lsws restart
Testing It All and Fixing Common Problems
- Opened my browser and went to: https://n8n.mywebsite.com
- Checked that:
- The n8n editor loaded properly.
- No “Connection Lost” message appeared.
- Workflows saved and executed without problems.
If something didn’t work, I double-checked:
- My Docker environment variables.
- That the external processor name (
myn8ndocker
) matched everywhere. - My rewrite rules were correct.
Wrapping It Up
And that’s it!
By following these steps, I was able to install n8n on CyberPanel without much trouble.
What I learned:
- Docker makes running apps like n8n super easy.
- CyberPanel + LiteSpeed can handle reverse proxying if you configure it properly.
- A little patience fixing small mistakes goes a long way.
Pro Tips:
- Always use Docker volumes for important app data.
- Always set
N8N_HOST
,N8N_PROTOCOL
, and related environment variables so n8n doesn’t think it’s running on localhost. - Keep your server clean: don’t expose ports directly if you can route through a proxy.
Now that I have n8n running perfectly, I’m free to start building automations that save me time every single day.
I hope it helps you!