Spring Fresh Sale! - Up To 67% OFF BDIX Hosting + Free Domain
Node.js

How to Deploy an Express.js App on cPanel Shared Hosting

Deploying an Express app on cPanel means uploading your files, creating the app in Setup Node.js App, installing dependencies, and making sure Express listens on the port Passenger provides. Follow these steps and your API or site will be live on shared hosting.

Step 1: Prepare your app

Ensure Express listens on the Passenger-provided port, not a hard-coded one:

const port = process.env.PORT || 3000;
app.listen(port);

This single detail prevents the most common deployment failure.

Step 2: Upload your files

Upload your project (without node_modules) to a folder in your account via File Manager or SFTP. Include your package.json and lockfile. This folder is your application root.

Step 3: Create the app in cPanel

  1. Open Setup Node.js App in cPanel.
  2. Choose your Node.js version, application root and startup file, and the URL/subdomain.
  3. Create the application.

Step 4: Install dependencies and start

Click Run NPM Install to install your packages β€” see installing npm packages β€” then start/restart the app.

Step 5: Test and secure

Visit your URL to confirm it works. Add free SSL. If you hit "Cannot GET" or a start error, see the "Cannot GET" fix and "application failed to start".

Frequently asked questions

Why does my Express app show a port error?

Because it is trying to use a fixed port. On cPanel, listen on process.env.PORT so Passenger can assign the right one. This is the most frequent Express-on-cPanel issue.

Do I upload node_modules?

No β€” upload package.json and your lockfile, then Run NPM Install on the server so dependencies are built for the server environment.

Is shared hosting enough for my Express app?

For typical APIs and sites, yes. If your app needs always-on background processing or heavy resources, consider a VPS.

Was this article helpful?