How To Setup Node.js App in cPanel

Setup Node.js App in cPanel

Node.js is a popular, event-driven JavaScript runtime you can use to build robust web applications. If you are already familiar with creating Node.js apps, you may be wondering how to get your app onto a shared server, a hosting environment in which you are limited in customization. Node.js requires some configuration of your server environment. But now, you can use a virtual environment within your shared hosting environment that allows for the customization necessary to run your app. Learn how to set up a Node.js in cPanel below.

Setup Node.js App in cPanel

  1. Log into cPanel
  2. Choose Setup Node.js App under Software
    Setup node.js app
  3. Click Create Application (002)
    Create node.js application
  4. Fill in the Application root field (this is the directory in which you will upload for application files)
  5. Select your Application URL and startup file (if you do not name a startup file, app.js is used as the default)
  6. Fill in the remaining fields with your preferred values
  7. Click Create when ready

Enter The Virtual Environment Command Line

If necessary, you have the option of logging into your server via SSH and administering the app on the command line. For some users, it is considered preferable or faster to do some administrative work on the command line. With this cPanel feature, you can easily access the command line for your app and work in a safe, virtual environment.

Copy the “source” command listed above your app settings:

Source command to enter application

Once you have logged into the server via SSH, copy and paste the “source” command into the command prompt and hit ENTER.

You will then see that you have been logged into your Node virtual environment, seeing a command prompt similar to the following:

[example-node-root (10)] [userna5@server-hostname example-node-root]$ 

Stopping and Restarting Your App

You can also stop and restart your app whenever you may need it. This can be done easily from the cPanel interface.

  1. Log into cPanel (as you did above)
  2. Choose Setup Node.js App under Software
  3. Select your app from the list of existing applications
  4. Click to stop, restart, or edit your application under the Actions table
    Stop, restart, or edit node.js application

Well done! You now know how to set up a Node.js app in your cPanel.

Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

8 thoughts on “How To Setup Node.js App in cPanel

    1. Hello Anto – you need to stop the corn job directly in cPanel. You can remove the corn or simply change its scheduling so it stops.

    1. Sorry for the confusion, the Setup Node.js option is only available on Power and Pro plans. I have added an alert to the article to clarify this.

  1. Hi, I tried to restart the application from the terminal but didn’t find any solution for that? Have you ever tried it programmatically with an ssh connection?

    1. Hi Orcun, we normally use the cPanel method since we’re focused on cPanel support and the web hosting side of things more than application development, especially on the Shared Hosting accounts that this article is focused on; you can try using the project restart described in the Node.js documentation or setting up a method like this Node.js application restart script as described by an expert Node developer, but those types of scripts may not work as well on a Shared Hosting plan. Hope that helps, though!

    1. Hi Amit, and thanks for the question! you should be able to restart the application following step 4 under “Stopping and Restarting Your App”. Are you running into any errors when trying to restart this way?

Was this article helpful? Join the conversation!

Shop the Black Friday Sale
Hurry! These Deals Won't Last Long