I created a basic Node.js application and purchased a HostGator VPS with WHM. From the VPS, I installed Node.js, Apache, and other necessary components. In cPanel, I set up version 12 of Node.js and used PM2 to run the Node.js application. Additionally, I created the application from the Application Manager, associated it with the primary domain, and appended "/nodejsapp" to the URL. I also specified the application path.
However, when attempting to make a GET request from Postman, it reports that the page was not found. Any ideas on what might be causing this issue?
This execution works fine, but when I try it from the production URL, it fails.
would like to be able to access the API I created from the production URL. However, when trying from Postman or the browser, it says: Page not found
2
Answers
If you are using cPanel Application Manager, you should follow this prerequisites before register the app : https://docs.cpanel.net/knowledge-base/web-services/how-to-install-a-node.js-application/
You’ll have to put the base application path to the one outside of Public_html and the Application path to be where you have placed your backend Files. This is how I was able to fix this.
Note: I’m also thinking of change the WHM to cloudlinux so I’m able to have Nodejs selector for all cPanel users inside WHM so no need to setup applications manually instead use cPanel to set one up.