Knowledgebase article

How to set up a Node.js application in cPanel

Not every heart beats in PHP. If your website or API is built with Node.js (Express, Next.js and friends), Romeo's hosting can run it with Setup Node.js App.

Step 1: Upload your app

Upload your project files (without the node_modules folder) with File Manager or FTP into a folder outside public_html, for example /home/cpaneluser/myapp.

Step 2: Create the application

  1. Log in to cPanel and go to Software > Setup Node.js App.
  2. Click Create Application.
  3. Fill in:
    • Node.js version: choose the version your app needs (the newest LTS is a good default)
    • Application mode: Production
    • Application root: the folder you uploaded to, e.g. myapp
    • Application URL: the domain or subdomain where it should run
    • Application startup file: your main file, e.g. app.js or server.js
  4. Click Create.

Step 3: Install dependencies

On the application's page, click Run NPM Install. This installs everything listed in your package.json.

Need extra environment variables (like an API key)? Add them under Environment variables, then click Save.

Step 4: Start (or restart) it

Click Start App (or Restart after changes). Open your Application URL in the browser. Your app is live!

Good to know

  • Your app must listen on the port the server gives it. In your code, use process.env.PORT instead of a fixed port number:
const port = process.env.PORT || 3000;
app.listen(port);
  • After every code change, click Restart on the app's page.
  • To run npm or node commands yourself, copy the Enter to the virtual environment command shown at the top of the app's page and paste it into your SSH session (see How to use SSH access).
  • Errors? Look for a log file in your application folder (often stderr.log).

Heavy or always-busy apps may need more resources than shared hosting offers. Ask Romeo about a Cloud or Managed Server.

Was this answer helpful?

Related articles

Still stuck? Romeo's got you.
Our support team replies around the clock, real humans who know your server.