I found some posts on the n8n community talking about the installation of n8n on Cpanel using node js so anyone has done it successfully? please yes if tell me how to do
Hey @Kanhaiya_Lal_Bohra, welcome to the community!
Afaik, cpanel doesnāt have any support for managing generic npm applications or docker containers. Meaning you would have to manually install n8n alongside cpanel on your server.
Hi!
Iām using n8n in my shared hosting with cPanel. II talked to the hosting tech support (LucusHost, a very good Spanish hosting) to see if I could install it on their āNodeJSā plan and their elastic hosting, and they solved it without any problem.
This is the configuration I have in my cPanel if this help you:
They told me that if more people needed it, just send them a ticket to support to install it.
And on top of that they gave me a discount coupon! ![]()
Hey guys! I know itās been a super long time, but I just stumbled upon this thread, and I am also running n8n on a shared hosting (not cPanel, but very similar, it uses PassengerPhusion to manage node apps just like cPanel).
My setup is very similar to yours, but I switched āApp rootā and āStartup fileā.
Just letting that here in case it can serve somebody in the future!
Steps :
- Create domain and relevant DNS config from xPanel
- Create new node app from xPanel :
a. Select domain
b. Select working directory for the app files
c. Startup file :node_modules/n8n/bin/n8n - Run
npm init && npm install n8ninside the working directory (or create/updatepackage.jsonwithn8nas dependency and run install command from the UI) - Run the app
- Enjoy!
I am also chiming in to contribute. I just solved this myself on a CloudLinux WHM/cPanel server.
The method I used was to use the CloudLinux Managerās NodeJS selector tool to make the Node App Setup module available on my cPanel accounts, and then I installed N8N via cPanel Terminal. My method presupposes you have terminal access on the cPanel account. Have your host do this for you if you are on shared CloudLinux hosting or a VPS where you donāt have root level access.
Then, the process I followed was thus, building off of what lolcabanon said:
- Set up cPanel account with Shell Access enabled (terminal).
- Let AutoSSL run.
- Setup Node app in cPanel. Only input node version and application mode as development and then hit create, donāt add anything else or set application paths yet. The default startup file will be app.js. Weāll change this later. Copy the node virtual environment entry command from the top of the app page after creating the app.
- Go to cPanel terminal and paste this in. Youāll now have node environment access and be in the application folder.
- Initialize NPM with ānpm init -yā
- Install N8N, this will take a while and might require some fussing with dependencie, etc, or running the command multiple times if the terminal times out. - ānpm install n8nā
- After installing n8n, return to the node application page in cPanel. Change the application startup file to: ānode_modules/n8n/bin/n8nā
- Then, Set environment variables in the node app, including webhook destination like such:
- N8N_BASIC_AUTH_ACTIVE - true
- N8N_BASIC_AUTH_USER - [username]
- N8N_BASIC_AUTH_PASSWORD - [password]
- N8N_HOST - set to 0.0.0.0
- WEBHOOK_URL - [https://your-installation-domain.com]
- Other Environment variables might be good to configure like max execution runtime (default 60 mins), saving execution data only on error to save disk space, etc. by default, it auto deletes executions after a couple weeks in a rolling window. Otherwise, everything else is good.
- Set environment to production.
- Open the domain and create an owner account for the N8N installation, these are the login credentials.
- Register community license if desired for the additional features.
- To keep N8N automatically up to date, you will create a workflow that uses the execute code module to run a shell script. Write that yourself or have ChatGPT assist. Then, set it to run the check every 24 hours. Update NodeJS version in cPanel every year or so to ensure you stay within the supported node versions.
Cheers.
You can also manually update N8N by navigating to the app folder directory in the terminal (displayed in the node app setup page) and running:
npm update n8n
Then, restart the node app.
Hello @MattH , I installed n8n on cPanel following your tips, but I have a problem and I have no idea how to solve it.
Every day when I access the URL of my installation for the first time, I get the following message:
ān8n is starting up. Please waitā
I donāt know if it has something to do with my cPanel server when it does a daily backup. I have the impression that this always happens when āthe day changesā, my hosting runs other things besides n8n and a general backup is always done at 11 pm.
Is there any configuration that needs to be done to prevent this from happening, or to make n8n start up again by itself as a node app?
good morning,
I installed an n8n instance under node.js in Cpanel following your advice.
Everything went well.
Unfortunately, I canāt install community nodes. I get this message
Thanks
Hi
Iām new in n8n, and i need to hosting n8n in Cpanel.
I follow the steps, the 16 step, i do not understand this step, can help?
www.mydomain/n8n i have the msg:
" It works!"
nodeJS 14.21.2
Hi
First tell your hosting provider to update the Nodejs Minimum version Node 18.17.0.
Second on cpanel set Application startup file to node_modules/n8n/bin/n8n instead of app.js
And Last on Enviroment Variables add N8N_PORT 5678
Best regards
Hi, Try this manual for install n8n at Cpanel.
Environment variables:
N8N_BASIC_AUTH_ACTIVE true
N8N_BASIC_AUTH_PASSWORD [password]
N8N_BASIC_AUTH_USER [username]
N8N_HOST localhost
N8N_LOG_LEVEL debug
N8N_PORT 5678
N8N_PROTOCOL https
N8N_PUSH_BACKEND websocket
QUEUE_HEALTH_CHECK_ACTIVE true
VUE_APP_URL_BASE_API https://mysite.com/
WEBHOOK_URL https://mysite.com/
n8n Version 1.100.1 show error - Problem running workflow. Lost connection to the server.
#[details=āinstance informationā]
Debug info
core
- n8nVersion: 1.100.1
- platform: npm
- nodeJsVersion: 22.16.0
- database: sqlite
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: memory
pruning
- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions
client
- userAgent: mozilla/5.0 (windows nt 10.0; win64; x64; rv:140.0) gecko/20100101 firefox/140.0
- isTouchDevice: false
Generated at: 2025-07-03T17:01:54.988Z}
[/details]
Thanks
I had successfull install n8n on cpanel but using npm global at SSH terminal, I run n8n with pm2 to keep running and setup .htaccess so it can run with port 80.
But the problem is after login and start create new workflow at toolbar info āConnection Lostā. like this
![]()
Information on my n8n setup
- n8n version: ? 1.102.4
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): pm2
- Running n8n via (Docker, npm, n8n cloud, desktop app): npm in cpanel
- Operating system: Linux hosted on cpanel 4.18.0-553.27.1.lve.1.el8.x86_64
setup file ecosystem.config.js for pm2
module.exports = {
apps : [{
name : "n8n",
script : "/home/pelitafa/agenai.host.com/node_modules/n8n/bin/n8n",
args : "start",
node_args: "--max-old-space-size=2048",
env: {
"N8N_HOST" : "localhost",
"N8N_PROTOCOL": "https",
"N8N_DIAGNOSTICS_ENABLED": "false",
"N8N_VERSION_NOTIFICATIONS_ENABLED": "false",
"EXTERNAL_FRONTEND_HOOKS_URLS": "",
"N8N_DIAGNOSTICS_CONFIG_FRONTEND": "",
"N8N_DIAGNOSTICS_CONFIG_BACKEND":"",
"N8N_ONBOARDING_FLOW_DISABLED": "true",
"N8N_PUBLIC_URL": "https://agenai.host.com",
"N8N_RUNNERS_ENABLED": "true",
"N8N_PUSH_BACKEND": "websocket",
"WEBHOOK_URL": "https://agenai.host.com",
}
}]
}
What you should suggest?
Thanks
I fixed the issue by adding a rule to set the āOriginā header for each HTTP request on the Apache (Passenger) web server.
Specifically, I added the following rules to the file /home/mysite/public_html/.htaccess:
SetEnvIf Host "^" ORIGIN=https://n8n.mysite.com
RequestHeader set Origin %{ORIGIN}e
Additionally, I also added CORS settings in the Nginx virtual host configuration.
Hi bro,
My hosting provider doesnāt provide 18.17.0 version so i have selected 18.20.8 now when i visit my domain it shows 503 error any solution?
I really appreciate your documentation and efforts. However, could you please guide us step-by-step on how to install n8n on cPanel, including the exact commands to use? Iām new to n8n and would greatly appreciate a detailed walkthrough.
Here are my cPanel specifications:
-
Node.js support: up to v24.6.0
-
Web server: LiteSpeed
-
PHP version: up to 8.2
Hi! Could you solve the 503 issue?
did you fixed it?
Hi. yes. in /etc/nginx/conf.d/users/startup/startup.site.com/proxy.conf
Add next configuration
proxy_http_version 1.1;
# WebSocket headers
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Standard headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Important for SSE/WebSocket
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
I was running n8n v1.x on cPanel with an over 4-month-old update. With the constant upgrade notice on my UI i decided to ānpm update n8nā. My issue was that my server keeps killing the command, because the server hit its process limit (ulimit) while trying to run a native build script (node install.js inside ssh2). Shared servers often cap the number of processes a user can spawn. At first i thought this was my fault, so i deleted nvm nodejs and npm with n8n to start afresh.
Same issues. so i run ānpm install -g n8n --foreground-scripts --no-fund --no-auditā which succed with few errors [@sentry/profiling-node, cpu-features, ssh2 crypto) because my server does not support std=gnu++20 (minor issue)⦠But is still work. after seeting node.js app on cPanel i was hit with a 503 server error. Repeated the whole process with a few configuration tweak i got "n8n is starting up. Please wait,ā but nothing happened. While n8n works via the terminal, the UI via a Node.js app does not work. This was because Passenger expects a Node.js HTTP server that listens on a port it provides, but n8nās bin/n8n is a CLI entry point, not a Passenger-compatible app. So i had to create a wrapper app.js that Passenger can actually manage.
i created a root folder ān8n-appā with some back and forth, I arrived at the same āTerminal working, UI not working,ā but now I canāt tweak the code.
I resorted to running pm2:
npm install -g pm2
pm2 start /home/server-name/.nvm/versions/node/v25.8.0/bin/n8n --name n8n ā start
pm2 save
pm2 startup (Auto start does not work on shared hosting. Use the cron job below.)
By activating pm2 n8n and the Node.js app cPanel, the code works, but with a high resource process requirement.
At this point, n8n ācode nodeā does not work because the code node and other nodes, such as the http node runs separate JS Task Runner process, which gets killed bythe limit process for cPanel, so add āN8N_RUNNERS_ENABLED=falseā to the environment variable.
Another real problem not mentioned was that the Passenger buffers HTTP responses. SSE (Server-Sent Events) requires a live streaming connection. Passenger kills it, so n8nās frontend never gets the āreadyā signal, stuck on āstarting upā forever. So adding "PassengerResponseBuffering offā to .htaccess was necessary for Apache unless you are using litespeed server like me, then no need because litespeed buffers SSE regardless.
Why v1.x worked, and v2.x doesnāt on shared hosting:
| n8n v1.x | n8n v2.x | |
|---|---|---|
| Architecture | Single process | Multi-process |
| Code execution | Runs inside main process | Separate Task Runner process |
| Real-time UI | WebSocket | WebSocket + SSE push |
| Memory | ~150MB | ~400MB+ |
| Processes needed | 1 | 3+ (main + task broker + runner) |
| Shared host friendly |
The core issues of v2.x architectural changes:
-
ān8n is starting upā - v2.x frontend waits for an SSE push connection to confirm readiness. v1.x didnāt need this - it just loaded. Passenger/LiteSpeed buffers SSE, so the confirmation never arrives.
-
Code node timeout - v2.x runs code in a separate Task Runner process. On shared hosting, that process gets killed by process limits. v1.x ran code inline.
-
High process count - v2.x spawns task broker + runner + main. v1.x was one process.
Real options:
-
Downgrade to n8n v1.x - works perfectly on shared hosting, simpler, fewer processes. Loses some newer nodes.
-
Stay on v2.x + pm2 proxy - with multi processes, front/backend separation, and multithreading, the resource will be heavy.
-
Move to a VPS - removes all these constraints permanently.
If you choose to still stay on cPanel with v2.x like me, then set up your server like this:
Run this bash command on your terminal to create the app.js file
āTo copy and paste into a file, remove the first and last line with (E0F).ā
cat > /home/server-name/n8n-app/app.js << 'EOF'
const http = require('http');
const httpProxy = require('http-proxy');
const fs = require('fs');
const PASSENGER_BIND = process.env.PORT || 3000;
const N8N_PORT = 5678;
const proxy = httpProxy.createProxyServer({
target: `http://127.0.0.1:${N8N_PORT}`,
ws: true,
changeOrigin: true,
proxyTimeout: 120000,
timeout: 120000,
});
proxy.on('error', (err, req, res) => {
if (res && res.writeHead) {
res.writeHead(502);
res.end('n8n unavailable');
}
});
const server = http.createServer((req, res) => proxy.web(req, res));
server.on('upgrade', (req, socket, head) => proxy.ws(req, socket, head));
const isSocket = isNaN(PASSENGER_BIND);
if (isSocket) {
if (fs.existsSync(PASSENGER_BIND)) fs.unlinkSync(PASSENGER_BIND);
server.listen(PASSENGER_BIND, () => {
fs.chmodSync(PASSENGER_BIND, '777');
console.log('[proxy] Listening on socket:', PASSENGER_BIND);
});
} else {
server.listen(parseInt(PASSENGER_BIND), () => {
console.log('[proxy] Listening on port:', PASSENGER_BIND);
});
}
EOF
Create your env in n8n by running this command:
cat > .n8n/.env << 'EOF'
N8N_RUNNERS_ENABLED=false
N8N_PORT=5678
N8N_LISTEN_ADDRESS=127.0.0.1
N8N_PROTOCOL=https
N8N_HOST=n8n.yoursite.com
N8N_EDITOR_BASE_URL=https://n8n.yoursite.com
WEBHOOK_URL=https://n8n.yoursite.com/
N8N_PUSH_BACKEND=sse
EOF
Start your n8n via pm2:
pm2 start .nvm/versions/node/v25.8.0/bin/n8n --name n8n -- start
pm2 save
Start your cPanel Node.js app:
| Field | Value |
|---|---|
| Application Root | n8n-app |
| Startup File | app.js |
| Application URL | n8n.yoursite.com |
Then edit the generated .htaccess file in your subdomain/domain folder by running this command:
cat > subdomain/node_modules/n8n/bin/.htaccess << 'EOF'
SetEnvIf Host "^" ORIGIN=https://n8n.yoursite.com
RequestHeader set Origin %{ORIGIN}e
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
SetEnv GENERIC_TIMEZONE "Africa/Lagos"
SetEnv N8N_AI_ASSISTANT_BASE_URL "https://ai-assistant.n8n.io"
SetEnv VUE_APP_URL_BASE_API "https://n8n.yoursite.com"
SetEnv N8N_PUSH_BACKEND "sse"
SetEnv WEBHOOK_URL "https://n8n.yoursite.com"
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END
# All of the above codes are not realy needed if set in you n8n env file!
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/server-name/n8n-app"
PassengerBaseURI "/"
PassengerNodejs "/home/server-name/.nvm/versions/node/v25.8.0/bin/node"
PassengerAppType node
PassengerStartupFile app.js
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
PassengerMaxPoolSize 1
PassengerResponseBuffering off
PassengerProxyBuffering off
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
Header set X-Accel-Buffering "no"
EOF
Then restart the cPanel Node.js app:
Or use this bash command:
touch /home/server-name/flow-app/tmp/restart.txt
You can also pm2 restart n8n in the terminal.
Check out your domain.
Also, set up a cron job to check for pm2 shutdown
cPanelās Cron Jobs section, fill in:
| Field | Value |
|---|---|
| Minute | 0 |
| Hour | 0 |
| Day | * |
| Month | * |
| Weekday | * |
| Command | /home/server-name/.nvm/versions/node/v25.8.0/bin/pm2 resurrect |
That runs once at midnight daily (as a reboot fallback isnāt available in cPanel cron).
But more usefully, add a second cron that checks if n8n is alive every 5 minutes and restarts it if it crashed:
| Field | Value |
|---|---|
| Minute | */5 |
| Hour | * |
| Day | * |
| Month | * |
| Weekday | * |
| Command | /home/cloudnit/.nvm/versions/node/v25.8.0/bin/pm2 describe n8n \> /dev/null 2\>&1 |
/home/cloudnit/.nvm/versions/node/v25.8.0/bin/pm2 describe n8n \> /dev/null 2\>&1 || /home/cloudnit/.nvm/versions/node/v25.8.0/bin/pm2 start /home/cloudnit/.nvm/versions/node/v25.8.0/bin/n8n --name n8n ā start
Note v2.x uses a lot more process regardless of the tweak.
Hello everyone! This is indeed a common point of friction for many looking to self-host n8n. In our work with enterprise automation, weāve identified that the key lies in meticulous environment setup, often overlooking execution permissions and process isolation for n8n workers. Within cPanel, leveraging cron jobs for health check monitoring and optimizing PHP/Node.js configurations are crucial. If you need a more in-depth guide or specialized support to ensure a robust and secure implementation, our team has extensive experience in these complex āAutomation Opsā scenarios. We are available to share best practices and ensure your setup meets production reality standards. Good luck!





