Reputation: 1
i want to run the node application in cPanel server how to configure and run node application in cPanel server.
Upvotes: 0
Views: 3319
Reputation: 287
You should add the following code in the .htaccessfile where XXXXX is the port number
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]
Then you should type in your terminal
nohup npm start &
and in your package.json don't forget to add this script
"start": "nodemon index.js --exec babel-node --presets es2015,stage-2"
Upvotes: 3