SOLVED node.js test app 403 fobidden error

leonep

Well-Known Member
Nov 18, 2014
121
3
18
Pescara
cPanel Access Level
Root Administrator
Hi,
i am testing node,js on my server. i am following cpanel guide.
curl test is ok

Code:
#curl http://127.0.0.1:3000
Hello World! NodeJS
i have made test application in application manager,
name; nodejsapp
Application URL: /nodejsapp
path: nodejsapp/app.js


but if i open browser in my location ( mydomain.xxx/nodejsapp) it returns error 403.
in apache error log i found this error:
Code:
[Sat Sep 14 20:01:26.147493 2019] [autoindex:error] [pid 14056:tid 47401738032896]
[client xxx.xxx.xxx.xxx:15581] AH01276:
Cannot serve directory /home/*******/public_html/nodejsapp/:
No matching DirectoryIndex (index.php,index.php5,index.php4,index.php3,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.wml,Default.html,Default.htm,default.html,default.htm,home.html,home.htm,index.js) found, and server-generated directory index forbidden by Options directive
any help please? thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,912
2,241
363
Hello @leonep,

The error message you shared suggests Apache is attempting to serve the application from the account's public_html directory. Node.js applications are served through Passenger and are not required to exist in the public_html directory.

Do you have any Mod_Rewrite rules in the .htaccess file under the account's home directory or under the public_html directory that could be redirecting the request to that location?

Thank you.
 

leonep

Well-Known Member
Nov 18, 2014
121
3
18
Pescara
cPanel Access Level
Root Administrator
finally everything went well,
I had the wrong path as a newbie ... however in fact the solution was to place the app in the home (/ home / user / nodejsapp)
thanks, congratulations for your kindness and sorry for the trouble!
thread solved
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,912
2,241
363
finally everything went well,
I had the wrong path as a newbie ... however in fact the solution was to place the app in the home (/ home / user / nodejsapp)
thanks, congratulations for your kindness and sorry for the trouble!
thread solved
I'm happy to see your application is now working well. Thanks for sharing the outcome!