Skip to main content

Use Node.js on your cPanel Hosting

Updated over 2 weeks ago

Node.js allows you to run web applications on the server side using JavaScript, providing an efficient and scalable solution.

In this guide, you will learn how to easily configure a Node.js application on your hosting with cPanel, following a practical step-by-step approach based on our example application.

Create the Node.js App on your cPanel hosting

1. Log into your cPanel and go to “Setup Node.js App”, which is located under the “Software” group:

2. Click the “Create Application” button to add a new app:

3. Fill in your App details as follows:

  • Node.js version: version of Node.js that will run your App. If you are not sure which version to select, leave the recommended one, but make sure the “recommended” is selected.

  • Application mode: it is your app’s environment variable that defines the execution mode. By default, if you don’t know what this variable is, we suggest selecting “Production”.

  • Application root: you must indicate the name of your App folder, which you uploaded in the previous step.

    • If your app is uploaded in /home/user/test.domain.com, in this field you should put “test.domain.com”.

  • Application URL: here you will indicate which URL your app will respond to. By default you can leave it empty so that your App responds on your root domain. However, if you want your app to be accessible via a subfolder, for example, domain.com/testapp, you must put “/testapp” in this field (with the slash at the beginning).

  • Application startup file: you must indicate the name of your Node.js app’s main file (with the “.js” extension).

4. Click “Create” to create the application.

If everything went well, you will see a green message at the top of the screen confirming that the application has been successfully created.

5. Once the App is created, on the next screen you will see the “Run NPM Install” button to install npm and your App dependencies. Click on it:

Done! If everything went well, when you visit your domain (or the URL you assigned when creating the App) you will see your application running.

Did this answer your question?