How to upload NodeJS website to hosting

Installing NodeJS
  1. After entering the control panel, go to the "System> SSH terminal" page and enter the username and password of your control panel in the displayed terminal (log in).
  2. To install the NodeJS package, type the following command in the terminal "sudo apt-get update -y && sudo apt-get install curl nano -y && cd ~ && curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh && sudo apt-get install nodejs build-essential -y".
  3. To view the version of the NodeJS package, type the following command in the terminal "nodejs -v".
  4. To view the npm package version, type the following command in the terminal "nodejs -v".
Launching the NodeJS test program
  1. By typing the following command in the terminal "sudo mkdir /nodejs_hello_world && sudo chmod 777 /nodejs_hello_world && cd /nodejs_hello_world" Create a folder where we will further create the NodeJS program.
  2. By typing the following command in the terminal "sudo printf "const http = require('http');\nconst hostname = 'localhost';\nconst port = 3000;\nconst server = http.createServer((req, res) => {\nres.statusCode = 200;\nres.setHeader('Content-Type', 'text/plain');\nres.end('Hello World');\n});\nserver.listen(port, hostname, () => {\nconsole.log('Server running at http://localhost:3000/');\n});" > /nodejs_hello_world/hello_world.js" Create a NodeJS program file (/nodejs_hello_world/hello_world.js).
  3. To run the NodeJS test program, type the following command in the terminal "nohup sudo node /nodejs_hello_world/hello_world.js &".
  4. In case of server reboot to automatically start NodeJS program, go to the next page "System > SSH terminal"  and in the text field below the terminal (The script runs automatically when the system starts) type the following command "nohup sudo node /nodejs_hello_world/hello_world.js &" and click "Save" button.
  5. To be able to open the NodeJS program in a browser, go to the next page "Domain > HTTP Reverse proxy" and select the desired domain or subdomain with which you want to open the NodeJS program, also in the field "Redirects to" type the following address "http://localhost:3000" and click "Create".
  6. Wait 5 minutes and log in to your chosen domain or subdomain with the browser, after which the NodeJS program will open.


  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to upload Python website to hosting

Installing Python After entering the control panel, go to the "System> SSH terminal" page and...

Change web hosting configuration (Upgrade or Downgrade settings)

To change (Upgrade or Downgrade) your web hosting configuration, go to the Services page  and...

How to upload ASP.NET Core website to hosting

Installing Asp.Net Core software After entering the control panel, go to the "System> SSH...

Upload PHP-MySQL website to hosting

Follow the instructions below to upload a standard PHP/MySQL website to your hosting: Log in to...

How to change PHP configuration

PHP configuration settings can be changed on the "System> PHP settings" page. if you need to...