vijay kumar
vijay kumar

Reputation: 1

How to run node application in cpanel and is that required to setup .htaccess file

i want to run the node application in cPanel server how to configure and run node application in cPanel server.

Upvotes: 0

Views: 3319

Answers (1)

HaYa Abu Al Halawa
HaYa Abu Al Halawa

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

Related Questions