Node.js app registered but not working correctly on Add-On domain
Hoping somebody can help with this. To start off with I will say I am by no means a beginner but this one has got me stumped. So here goes...
I got a VPS package through Namecheap which was the highest one available with Cent OS 7 (now 7.8), WHM + CPanel all installed and ready to go. There is a 5 account limit for the license I currently hold so naturally I have had to use one of the accounts to host a couple of domains outside of that account limit as these can be easily added via the Domains >> Addon Domain feature of CPanel. So there is the context to start off with.
I found through looking at various support articles that in more recent times Node.js applications can be used on domains through the use of either a Plugin which requires CloudLinux. Unfortunately I don't have that, I have Cent OS 7.8 but then I learned of another way using the feature manager in WHM to add something called Application Manager to CPanel in the Software section. So I thought great I can start registering my node.js applications on the domains as necessary. I made sure all the necessary modules were installed as it states in the articles on installation and sure enough managed to get a node.js app running fine on one of the domains, however this particular domain was held as is using one of the 5 accounts. The problem comes next...
I go to the account that holds 2 add-on domains through CPanel and try to register a node.js application installing all dependencies etc as I did before with the first node.js app, however the issue I'm facing is when visiting the application URL I simply get the entire root of the URL listing any folders and/or files within it and not what the app is supposed to output. The app is functioning correctly and is made up of the following:-
app.js - start file for the app
package.json
package-lock.json
Obviously the node_modules folder is there and everything was installed correctly just as the first time on the first domain I tried out on. The correct path is in place and I have tried adding a .htaccess file with the correct lines again as seen in two articles and both were identical in the lines added. I have tried changing the port number and made sure within the .htaccess file that where the sample lists http://127.0.0.1:XXXXX it is changed to reflect the port the app is listening on but it still won't work. In some cases by changing folder permissions I get a 503 error usually when I change the folder to 0711 where it is usually 0750. Nothing seems to help and this is only happening with Add-On domains not with the main domain.
I have also tried going into the conf file with the Virtual Hosts and adding this line:-
ProxyPass
As said the first app worked fine so don't understand what the problem is when trying to work with Add-On domains. Geez they never make these things easy for us to get working. Will never understand why things can't just work as they're supposed to.
Can anyone help please?
-
Hello @g_silverfox If you are only getting a directory listing when you attempt to visit the site, that means something is not configured to properly recognize the correct application startup file. Can you please provide us the contents of the following file? /etc/apache2/conf.d/userdata/ssl/2_4/$user/$domain.nodejs.conf Please edit the contents so that your domain name is not exposed. Best regards 0 -
Hello @g_silverfox If you are only getting a directory listing when you attempt to visit the site, that means something is not configured to properly recognize the correct application startup file. Can you please provide us the contents of the following file? /etc/apache2/conf.d/userdata/ssl/2_4/$user/$domain.nodejs.conf Please edit the contents so that your domain name is not exposed. Best regards
Thank you for replying to me. I performed a find from the bash terminal on the server and that file couldn't be located. I even did a lookup for *.conf and there is nothing that even looks like or resembles that file. There is only one file in that particular directory and it is called basic.conf so I'm at a limbo point again. Really don't understand why these things are so complicated and why they can't just work and perform as expected.0
Please sign in to leave a comment.
Comments
4 comments