Symptoms
You've configured your Node.js application on cPanel according to our documentation:
https://blog.cpanel.com/how-to-host-a-node-js-application-with-cpanel/
Although when you visit your domain, you get a 403 Forbidden error in your browser, and upon inspecting the Apache error log you see an error similar to the following one. To see this you can use the tail -fn0 command and then visit your domain in your browser to make the error appear:
tail -fn0 /etc/apache2/logs/error_log
[Fri Feb 26 05:38:06.491568 2021] [autoindex:error] [pid 21566:tid 47555971675904] [client xxx.xxx.xxx:64224] AH01276: Cannot serve directory /home/cpanelusername/public_html/: No matching DirectoryIndex (index.
php,index.php7,index.php5,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.jp,index.phtml,index.shtml,index.xhtml,index.html,index.htm,index.js) found, and server-generated directory inde
x forbidden by Options directive
Description
One specific part of the documentation that may be easy to overlook is the name of the Node application's index file.
On cPanel the Node application's index file, or entry point file, must be app.js . A common default name that is often found in applications is server.js which won't work on cPanel server.
Resolution
In order to get your application working on your cPanel server, you'll need to rename your application's entry point file to app.js so that mod_passenger can start your application properly and allow Apache to serve the content that mod_passenger generates from your application's code.
Depending on the specific code within your application, in addition to changing the name of the entry point file, you may need to change the actual code and configuration in some places. There is no way for us to be able to know the exact changes your application would need, so if you're not making progress on making this work for your application, you may need to reach out to a developer with a full understanding of how your application works. You could also search for community resources such as forums that are focused on your specific application and see if the community could help get you started in the right direction.
Comments
0 comments
Article is closed for comments.