How to Set Up and Run Node.js Applications in cPanel

63 views
Short answer: Launch Setup Node.js App in cPanel, click 'Create Application', choose Node.js version, assign application root directory and startup file, then run npm install.

Deploy Node.js, Express, and Next.js applications on Sib Host using CloudLinux NodeJS Selector, npm package manager, and Passenger application server.

Before you start: Back up your site files and database and download the backup to your own computer. How to take a full backup

Quick reference

Tool Location cPanel > Software > Setup Node.js App
Supported Node Versions Every version listed in Setup Node.js App; pick an LTS release
Startup File app.js or server.js
Engine Phusion Passenger (Automatic process management & SSL binding)

Steps

  1. Create Application in cPanel:
    • Navigate to Software > Setup Node.js App.
    • Click Create Application.
    • Node.js Version: Select your desired version (pick the newest LTS release in the list).
    • Application Mode: Select Production.
    • Application Root: Enter directory path (e.g., nodejs-app).
    • Application URL: Select your domain or subdomain.
    • Application Startup File: Enter app.js or server.js.
    • Click Create.
  2. Upload Project Files: Upload your application code to the nodejs-app folder via cPanel File Manager or Git. Do NOT upload the local node_modules folder.
  3. Install NPM Dependencies:
    • Return to Setup Node.js App in cPanel.
    • Click the Run NPM Install button. cPanel will read your package.json and install all dependencies in the server environment.
  4. Restart Application: Click the Restart button at the top of the application card. Your Node.js app is now live under HTTPS.

Troubleshooting and tips

  • Port Binding Error: Do NOT specify a fixed port like app.listen(3000). Under CloudLinux Passenger, the app must listen on process.env.PORT or allow Passenger to handle socket binding automatically:
    const PORT = process.env.PORT || 3000; app.listen(PORT, () => console.log(`Listening on ${PORT}`));
Need more help? If you run into an error while following these steps, open a ticket with technical support and our team will look into it. Open a ticket
Was this article helpful?
No, I need more help
Didn't find your answer?
Under 3 minutes
Submit Support Ticket