Reputation: 21
I want to run a Node.js Express app together with Apache configured by CPanel
Instructions for "CPanel How to Install a Node.js Application" describe setting up an Express app listening on port 3000. https://documentation.cpanel.net/display/CKB/How+to+Install+a+Node.js+Application. But CPanel >> Home >> Software >> Application Manager has no input to enter the port where requests should be forwarded.
The running Express app responds to curl http://127.0.0.1:3000
Expected a request to url http://example.com/nodejsapp to receive a response from the Node.js App but get a 404 Error instead. Should forwarding to a particular port be included ?
Upvotes: 2
Views: 8734
Reputation: 536
You mush config .htaccess :
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:XXXXX/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:XXXXX/$1 [P,L]
with XXXXX is your port .
Upvotes: 5