From now Hostiso support Node.js on any hosting package, even shared with easy to use interface inside cPanel. Node.js is used for hosting diffrent apps, like Ghost blogging platform, etc.
Bellow is instruction how to quickly and easily setup Node.js on your account if you do not host with Hostiso.
Installing Node.js and npm
Here several easy steps to quickly install Node.js and npm (the Node.js package manager). To do this, follow these steps:
cd ~
wget https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz
tar --strip-components 1 -xzf node-v16.13.0-linux-x64.tar.gz
mv node-v16.13.0-linux-x64 nodejs
mkdir ~/bin
cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm
node --version
npm --version
Now after installing Node.js, you are ready to run Node.js app. However, the exact steps to do this vary depending on the app configuration.
Many third-party and “production-ready” applications (such as Ghost) use the npm program to start the application, as shown by the following command:
nohup npm start --production &
For this method to work, there must be a valid package.json file for the application. The package.json file contains project metadata that the npm program reads to determine how to start the application, manage its dependencies, and more.
For simple apps, or for any application that does not have a package.json file, you can run the node executable directly and specify the application filename. For example:
nohup node my_app.js &
However, you lose the benefits of using npm to manage the application.
To stop Node.js app, just type the following command:
pkill node
Above command will immediately stops all running Node.js apps.
Depending on the type of Node.js application you are running, you may want to be able to access it using a web browser. To do this, you need to select an unused port for the Node.js application to listen on, and then define server rewrite rules that redirect visitors to the application. The following steps demonstrate how to do this:
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]
You can find all about Node.js, on http://nodejs.org.