I have created a Node js application using express & mongoose and deploy it to the web server using cpanel. I use their feature "Setup Node JS" to deploy it to my subdomain. on the first 6-7 days, it runs well, all function & feature runs properly without any problem and nothing bad happened. But suddenly, there is an error said internal server error 500 when opening the page.
I searched here to find a solution and yes, I got some solution to add this line of code
RewriteCond %{ENV:REDIRECT_STATUS} 200
to my .htaccess file. And it works (I still don't get it why at first it also worked out without adding this) and I can get my page back again. Well, kind of...not entirely.
However...
Everytime I use my login or sign up feature in my program (basically when try to run mongoose method such as User.find({})) it will hung up for 2-3 minutes until the page says the error:
on page: Incomplete response received from application
on console : 502 Bad Gateway
I have searched here but didn't find anything yet, only this question that has similar problem yet it hasn't been answered clearly yet to me like what port that needs to be open? where can I find it.
I am a total noob on programming and just started it, so how should I solve that error?
At this point I am not really sure what to show you guys to make it more understandable but I'll include my .htaccess file below. Additionally, I tested it on heroku and it runs perfectly normal. But it needs to be served on cpanel shared hosting and it's a little bit more complicated.
Thanks for your help.
My .htaccess file contain this:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/intidina/psikotes"
PassengerBaseURI "/"
PassengerNodejs "/home/intidina/nodevenv/psikotes/12/bin/node"
PassengerAppType node
PassengerStartupFile index.js
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END
RewriteCond %{ENV:REDIRECT_STATUS} 200