Namecheap: Node JS Express App - App Route return 404 not found Namecheap: Node JS Express App - App Route return 404 not found express express

Namecheap: Node JS Express App - App Route return 404 not found


Namecheap only tells you how to configure the nodejs app however their hosting is based on cPanel which requires you configure the webserver (apache generally). Once you get an application running there’s a special button to register it for the apache configuration aka let it run from your domain. I don’t know the steps by heart but you should ask NC support to direct you to their documentation for configuring apache to run a nodejs app you configured. If they do not link an article from their knowledge base use this link: https://confluence1.cpanel.net/plugins/servlet/mobile?contentId=17190639#content/view/17190639Basically what you need now is to configure cPanel or ssh into your server and test your app locally. There’s a number of things that could cause your issues like incorrect apache configuration (your default port 80 is looking for php app), port not open/firewalled, application not registered - and all of this is cPanel specific. To make sure you are reading the correct document check in namecheap cpanel for the docs button and review all the above. It should be obvious what needs configured - your nodejs code is probably not the cause here


In my case, it was the problem with .htaccess file. Adding the following rules in my .htaccess file present in the website's public directory helped me:

# CLOUDLINUX PASSENGER CONFIGURATION BEGINPassengerAppRoot "/home/<user>/<your_nodejs_app_folder>"PassengerBaseURI "/."PassengerNodejs "/home/<user>/nodevenv/<nodejs_app>/<version>/bin/node"PassengerAppType nodePassengerStartupFile <startup_script>.js# CLOUDLINUX PASSENGER CONFIGURATION END

Make the required changes in the above rules before pasting them in your .htaccess file. Also, just in case, make sure the port you are using is open, via customer support.