Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to host a Node.js app in cPanel

This guide shows you how to run a Node.js app on your hosting account with the cPanel app tool.

cPanel2 min read14 steps11 screenshots

What is Node.js?

Node.js lets you run JavaScript on a server. JavaScript is the language of web pages. With Node.js, the same language can build the back end of a site too. An app is the program that answers visitors.

cPanel has a tool called Setup Node.js App. It uses a system called CloudLinux. The tool may not be on your plan. Ask Hostvento support if you cannot see it.

Before you start

  • Have your app files ready. You need a start file, such as app.js, and a package.json file. The second file lists the add-ons your app needs.
  • Make a backup of your project on your own computer.

Steps

  1. Log in to cPanel.
    feature-manager
  2. In the Software section, click Setup Node.js App.
  3. Click Create Application.
    application-manager
    application-manager-cpanel
  4. Choose a Node.js version. Pick the one your app was built for.
  5. Set Application mode. Use Production for a live site.
  6. In Application root, type the folder for your app files, for example myapp. This folder is made in your home folder.
  7. In Application URL, pick the domain and an optional path.
    register-application
    application-configuration
    ensure-dependencies
  8. In Application startup file, type app.js, or your own start file name.
  9. Click Create.
  10. Upload your files into the application root folder with File Manager. Skip the node_modules folder.
    add-variable
  11. Go back to Setup Node.js App and open your app.
  12. Click Run NPM Install. NPM is the tool that downloads your app's add-ons.
  13. Click Restart.
  14. Open your domain in a browser to check the app.

A small test app

If you want to test the tool, use this tiny file as app.js.

save-variable
const http = require('http');
http.createServer((req, res) => {
  res.end('Hello from Node.js');
}).listen(process.env.PORT || 3000);

It answers every visit with a short message.

If something fails

  • Check the startup file name.
  • Look at the log in the app screen or in the stderr.log file.
  • Restart the app after every change to the files.
  • Open a ticket at https://secure.hostvento.com/submitticket.php if the tool is missing.
Tip: On a VPS with root access you can also install Node.js yourself and run your app with a process manager.

Quick recap

  • Use Setup Node.js App in cPanel.
    edit-nodejs
    nodeapp-manager
    unregister-nodejs
  • Pick the version, folder, URL and start file.
  • Upload files, run NPM Install and restart.
  • Ask support if the tool is not on your plan.