SOLVED Installing a Node.JS application on cPanel verison 80

Mar 25, 2012
20
2
53
Portsmouth, Virginia, United States
cPanel Access Level
Root Administrator
Hello @jasoncollege24,

The app.js file is the application's default startup file. We recommend that you create the file with this exact name because Passenger searches for this filename when it attempts to run the application.
Thank you! Renaming the file to app.js allows it to run the way it's expected. Just one more issue to resolve, and I'm good.

if I go to my example url of bots.jaysite.com my Discord bot comes online, and does exactly what I expect. Problem is that about a minute, or two after closing the browser tab, the bot goes offline. I need this app to continue running after the browser tab is closed.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,912
2,241
363
if I go to my example url of bots.jaysite.com my Discord bot comes online, and does exactly what I expect. Problem is that about a minute, or two after closing the browser tab, the bot goes offline. I need this app to continue running after the browser tab is closed.
Can you confirm that you've registered the application in Production Mode using cPanel >> Application Manager ? This should allow the application to start and remain running without the need to visit the application URL in a web browser.

Otherwise, if you can reproduce the same behavior with an open-source application, let me know the link to the application's GitHub and the full instructions you are using to to reproduce the behavior.

Thank you.
 
Mar 25, 2012
20
2
53
Portsmouth, Virginia, United States
cPanel Access Level
Root Administrator
I found a workaround that is easier for me to accomplish than getting cpanel to do it. With ea-nodejs10 installed, I created a custom service in CentOS 6.10 that uses node.js to bring the bot online via /etc/rc.d/init.d

Logged in as root via SSH, I can use the following commands on the bot...

service mybot start - starts the bot, and creates a lock file in the app's tmp directory
service mybot stop - stops the bot, if it's running, and deletes the lock file
service mybot restart - executes the stop command, then the start command on this service
service mybot status - gives a message indicating whether the service is running, based on the existence of the lock file.
 
  • Like
Reactions: cPanelMichael

Poonamk

Registered
Nov 18, 2019
2
0
1
201301
cPanel Access Level
Root Administrator
We have installed the test application provided in the example on the How To Install A Node.JS Application tutorial and we are successfully able to see the server running via SSH.

We then also have registered the application using cPanel >> Application Manager to enable the application under the document:
- Application Manager - Version 78 Documentation - cPanel Documentation

But we are unable to see result of nodejs app in web browser using our domain link.

The difference in our case is domain is mapped to jvm as our backend API are on Java and nodejs app directory is inside jvm directory.

Please can you let us know it will work or not if nodejs testapp is in /home/$username/jvm/Apache tomcat 8.5/domains/my domain.com/Root/testapp directory.

If not, please let us know how to make Java backend and Nodejs app work together using cPanel.

FYI, for our website, our frontend is in Angular 6 and backend in Java spring.

Urgent kelp needed please.
 

Poonamk

Registered
Nov 18, 2019
2
0
1
201301
cPanel Access Level
Root Administrator
What, if anything is noted in the related error logs when trying to view the site?
No.
As mentioned The difference in our case is domain is mapped to jvm as our backend API are on Java and nodejs app directory is inside jvm directory.
If jvm is mapped, Apache web server always routes to jvm, can mode_passenger still route?

Please can you let us know it will work or not if nodejs testapp is in /home/$username/jvm/Apache tomcat 8.5/domains/my domain.com/Root/testapp directory.