How to Set Up a Node.js Application in cPanel

Knowledgebase / How to Set Up a Node.js Application in cPanel

How to Set Up a Node.js Application in cPanel

0 found helpful (0 votes) ...
Back to Knowledgebase

cPanel includes a Setup Node.js App tool that lets you run Node.js applications on your hosting account without needing a VPS or root access. It manages Node.js versions, installs npm packages, and handles the application process lifecycle.


Open Setup Node.js App

  1. Log in at https://tpc-hosting.com/login and open cPanel.
  2. Under Software, click Setup Node.js App.
  3. Click Create Application.

Configure the application

  1. Node.js version: Select the version your application requires. Available versions are listed in the dropdown.
  2. Application mode: Choose Production for live apps or Development for testing.
  3. Application root: The directory where your Node.js app files are located (e.g., myapp — relative to your home directory). Create this folder first via File Manager if it does not exist.
  4. Application URL: Select the domain and optional path that will serve your app (e.g., yourdomain.com or yourdomain.com/app).
  5. Application startup file: The main entry point of your app (e.g., app.js or server.js).
  6. Click Create.

Upload your application files

  1. Upload your Node.js application files to the application root directory via File Manager or FTP.
  2. Make sure your package.json is in the application root.

Install npm dependencies

  1. In the Node.js App list, find your application and click Open application root in the terminal panel, or click the npm install button displayed in the application settings.
  2. Alternatively, SSH into your account (see: How to Connect to Your Hosting Account via SSH) and run:
    cd ~/myapp
    npm install

Start, stop, and restart the application

  • In the Node.js App list, each app has Start, Stop, and Restart buttons.
  • Click Restart after updating your application files or environment variables to apply changes.

Environment variables

  1. In the application settings, scroll to Environment Variables.
  2. Add key-value pairs for your app's configuration (database URL, API keys, port, etc.).
  3. Click Save and restart the application.

Troubleshooting

  • App not loading: Check that the startup file name matches exactly what you entered. Verify there are no npm dependency errors by checking logs via SSH (cat ~/myapp/logs/error.log or similar).
  • Port conflicts: Do not specify a port in your app code — cPanel handles routing automatically via Passenger. Remove any app.listen(PORT) calls that hardcode a port number, or use the PORT environment variable provided by Passenger.

Was this article helpful?



Still need help?

Open a support ticket →

On This Page