skip to Main Content

I’ve an API designed with Express configured to run on PM2 rather than on node process.

I’m using ventraIP shared hosting server with cPanel. CPanel provides an option to setup NodeJS app -> configure directory -> do NPM install and UI tools to run, restart or stop the application. The image below show the UI configuration options provided in cPanel.

enter image description here

The application works fine when started with the Setup NodeJS menu run. But to my understanding this takes the startup file configuration for the app and run node for that file when we click start.

I don’t want that to happen. I would like to run specific script to boot the server. Here I would be using "pm2 start . I don’t find a way to achieve this.

Is there a way where we could run a NodeJS app manually through terminal and have control over it. I want PM2 to handle the application process.

Server: ventraIP shared hosting plan
Technology: Node JS Express API with Maria DB

2

Answers


  1. I’m not familiar with that hosting but cpanel in general are usually for a more ‘managed’ solution so its more GUI based and from my experiance tries to abstract things away to make it simpler for users.

    As far as PM2 is concerned, you would need to ensure PM2 is installed and usable, it being shared hosting I doubt it would be but you would need to contact the hosting provider to be sure.

    As a side note, a long while back I was using cPanel as well to host a node app because it seemed like an easy way to do it with my hosting provider but after running into so many issues I abandoned it and moved to digital ocean and linode for my applications. You will have more control over things but will have to drop into the CLI more etc. They have pre-configured instances with PM2 and Node installed so it’s fairly simple to get started

    Login or Signup to reply.
  2. you can do with run js script

    and you can choose your package.json script there

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search