How to Host a Node.js App on Traditional cPanel Hosting

Unlike traditional PHP-based websites, Node.js apps operate on a different architecture, requiring persistent server-side processes. This can make deploying a Node.js application on cPanel hosting feel a bit unconventional. But with the right setup—and a supportive hosting environment—you can deploy such apps even on shared hosting plans.

node.js

This guide walks you through the step-by-step process of hosting such an app on cPanel, including tips, troubleshooting, and bonus steps to optimize your deployment.

First, Does Your cPanel Support Node.js?

Before you start uploading files or configuring your app, take a minute to verify the following two essentials:

  • Your hosting provider supports Node.js, typically via CloudLinux or CageFS.

  • You have access to the “Setup Node.js App” feature in your cPanel dashboard. This feature may also appear as “Application Manager” depending on your host.

If your hosting plan doesn’t include these features, you won’t be able to deploy a Node.js app using this method. In that case, consider upgrading to a VPS or a more flexible solution like Heroku, DigitalOcean, or Render.

Step-by-Step Guide on The Setup

1. Log in to cPanel and Open “Setup Node.js App”

  • Start by logging into your cPanel dashboard. Under the Software section, look for:

    🛠️ The Setup Section (or “Application Manager”)

    Click it to open the Node.js application manager.

2. Create a New Application

  • Now, click the Create Application button and configure your app:

    • Application Mode: Choose between Development or Production

    • Node.js Version: Select the version required for your app

    • Application Root: This is the directory where your app resides (e.g., /home/youruser/myapp)

    • Application URL: The public URL where the app will be accessible (e.g., https://yourdomain.com/myapp)

    • Startup File: Usually app.js or server.js

    Once configured, click Create. This sets up your environment and installs the necessary runtime.

3. Upload Your Node.js Files

There are multiple ways to upload your application files to your hosting environment:

  • 📂 Using File Manager in cPanel

  • 🔐 Via FTP/SFTP clients like FileZilla

  • 🔄 Git Version Control for automatic deployments from a GitHub/Bitbucket repo

Ensure your root folder contains essential files like:

  • package.json

  • server.js or app.js

  • Any configuration or static files your app needs

4. Install Dependencies

Head back to the App section in cPanel. You’ll find an option labeled Run NPM Install. Clicking this will install all dependencies listed in your package.json file.

💡 Pro Tip: If your app relies on environment variables, scroll down to the Environment Variables section to set them securely. This is useful for managing things like API keys, database URLs, and app configurations.

5. Start the App

Once everything is uploaded and dependencies are installed, it’s time to fire up your app.

  • Click Run or Restart App

If everything’s in order, your application should now be live and accessible from the domain or subdomain you specified earlier.

Testing Your Deployed Application

  • To make sure everything is working correctly:

    1. Visit the domain or subdomain you assigned to the app

    2. Check for any issues in the Application Log or Error Log under the Node.js App section in cPanel

    3. Ensure ports and routes are configured correctly in your app’s startup file

Bonus: Secure with HTTPS

If you’re using a custom domain, securing your app with SSL is critical.

  • Use AutoSSL in cPanel or install a Let’s Encrypt certificate

  • Configure your app to handle HTTPS requests and redirect HTTP to HTTPS if needed

Most modern hosting providers support AutoSSL out of the box, making this step quick and easy.

What If There’s No Node.js Option in cPanel?

Not all shared hosting plans support Node.js. If you don’t see the option:

  • 📨 Contact your hosting provider to verify Node.js support

  • 🔼 Consider upgrading to a VPS, cloud hosting, or platforms like Heroku or DigitalOcean, which are tailored for this.

You’re Live!

While Node.js and cPanel hosting aren’t always the most natural pairing, modern shared hosting providers have made big strides in compatibility. As long as you have access to the Setup Node.js App feature, you can deploy your app without needing a full-blown VPS.

This setup is ideal for small to medium-sized Node.js projects and is a cost-effective way to bring dynamic, real-time applications online.

Share this article
Shareable URL
Prev Post

How Nest Nepal Handles Server Outages (A Behind-the-Scenes Look)

Next Post

The Ultimate Guide to Picking Your First Hosting Plan (Without Regret)

Leave a Reply

Your email address will not be published. Required fields are marked *

Read next