Hostwizly

Host Node JS On Hostinger

Last Updated 16 September 2024 by Jarvis Silva

Looking for a tutorial on how to host your node js app on Hostinger then you are at the right place, In this tutorial I will show you how to host node js on Hostinger.

Node JS is a open source server side javascript runitime environment which allows us to create robust backend for websites.

Hosting your Node.js app on Hostinger is reliable and cost-effective, ensuring your app runs smoothly and efficiently.

Prerequisites

Before proceeding, ensure you have:

  • A Node JS app uploaded on Github.
  • A Hostinger account with a VPS plan.
  • Basic knowledge of SSH and Server management.

1. Get Hostinger VPS hosting plan

To host node js app we will use Hostinger VPS plan as we cannot host node js on shared hosting, so you need to purchase their VPS hosting plan, their basic VPS plan starts at 4.99$ per month which is quite cheap compared to other hosts.

Use this Special Hostinger discount link and get around 40-60% discount on VPS plans of Hostinger.

You can choose any of the VPS plan I will recommend to go with KVM 2 VPS plan as it has more resources you can also start with KVM 1 plan if you are just starting out or trying it so complete the registration and payment process let's go to the next step.

2. Setup VPS on Hostinger

So now let's setup the VPS, to setup follow below steps:

  • Login to your Hostinger account, go to VPS Section and click on Setup VPS.
  • First, it will display the option select the location of your VPS, it is recommended choose the nearest server location to your audience.
  • Next it will ask you to choose Operating System Type for your VPS, Select Plain OS as we don't want a control panel.
  • Hostinger vps operating system selection
  • Next it will ask you to choose the OS you want to install on your VPS click on "I want to choose a different operating system" and it will display multiple OS with different version select the latest ubuntu 20.04 64 bit OS in the future it might change.
  • Hostinger vps ubuntu os selection
  • Now it will ask you to enter your vps name, a root password and a SSH key(optional). Make sure you create a strong password and store it in secure place.
  • Also you can use a SSH keys authentication method for logging in to know more about it refer to this tutorial: how to setup ssh and use in vps
  • Hostinger vps details

After this your VPS setup will be completed, if you check in your Hostinger panel it will show VPS running, You will get a dedicated IP address for your server which you can use to access your site or you can connect a custom domain.

Also Read: How to connect custom domain in Hostinger vps.

So we have completed our VPS setup, now we need to ssh into our VPS and install node js on it so let's see how to do it.

3. Install And Run Node JS On VPS

Now we need to install Node js on our VPS server as it is required for running node js application so follow the steps below to install node js:

  • Go to Putty website and download the putty software it will allow you to login into server, after installing putty open it and enter the ip address of your vps in the putty hostname column and click open.
  • Putty Connection
  • It will open a terminal where it will ask you to enter username mostly it is root and the password which you created at your VPS setup, If you have used SSH keys then it will automatically detect and login to your server.
  • Now you should have access to your server, now you can write commands which will get executed on your server so first run the below command it will update your apt repository.
  • sudo apt update
  • Next run this it will install git
  • sudo apt install git
  • Now we will install node js so execute all the below command line by line
  • curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
    sudo apt install -y nodejs
  • Use below commands to check if node and npm are installed, If installed it will display their versions
  • node -v
    npm -v
  • Now let's create a new directory for our node js project and import it from github to do that use below commands:
  • mkdir ~/apps/demo
  • This command will make a new directory inside apps folder called demo you can name your project name
  • cd ~/apps/demo
  • it change the working directory to the directory we created
  • git clone enter-your-repo-url .
  • it will get our node js code from github to our server inside the apps/demo folder.
  • npm install
  • Above command will install all the node_modules for the project
  • npm install -g pm2
  • Now to run our node js app we need to install a library called pm2 it is like nodemon in node js so install it by using above command:
  • pm2 start your_app.js
  • Now run the above command to start your node js app on the port specified in your server file, you can view your node js app at your ip-address:port in the browser.

So we successfully hosted Node.js app on Hostinger. You can further optimize this deployment by installing Apache or Nginx web server

Also Read: Host next js on Hostinger

I hope you found this tutorial helpful and useful do share it with someone who might need it. Thank you for reading, Have a nice day 😊

Frequently Asked Questions

Do I need a VPS to host a Node.js app on Hostinger?

Yes, to host a Node.js app on Hostinger, you need to purchase a VPS plan.

What operating system should I use for my VPS?

It is recommended to use Ubuntu 20.04 64-bit for your VPS.

What is the cost of hosting a Node.js app on Hostinger?

The basic VPS plan starts at $4.99 per month.

Can I host multiple Node.js apps on the same VPS?

Yes, you can host multiple apps by creating separate directories for each app and managing them with PM2.

About the author

I am Jarvis Silva, a tech enthusiast. I have 5 years of experience in website hosting and development, Now sharing all my knowledge related to web hosting and other various tech on the internet through Hostwizly.

Related Articles

Host Django Website On Hostinger VPS

How To Add SPF Record In Hostinger

How To Increase WP Memory Limit In Hostinger

How To Download Files From Hostinger File Manager

How To Find FTP Password In Hostinger

How To Add Signature In Hostinger Webmail

How To Connect Namecheap Domain To Hostinger

How To Add DKIM Record In Hostinger Email

How To Add DMARC Record In Hostinger

How To Transfer Domain From Wix To Hostinger

How To Switch From Hostinger Website Builder To Wordpress

How To Find Ip Address Of Website In Hostinger

How To Purchase Domain And Hosting From Hostinger

How To Install Wordpress In Hostinger

How To Extract Zip File In Hostinger

How To Install Wordpress Theme In Hostinger

How To Backup Emails From Hostinger

How To Connect Hostinger Domain To Shopify

How To Setup Hostinger Email On Outlook

How To Setup Hostinger Email On Gmail

How To Add TXT Record In Hostinger

How To Add CNAME Record In Hostinger

How To Set A Cron Job In Hostinger

How To Install Wordpress On Subdomain In Hostinger

Deploy Angular App On Hostinger Shared Hosting

How To Change PHP Version In Hostinger

How To Install Moodle On Hostinger

How To Get FREE Hosting On Hostinger

Difference Between Hostinger.com And Hostinger.in

Host Laravel Project On Hostinger Shared Hosting

Host React App On Hostinger Shared Hosting

Is hostinger good for buying domain?

How to add hostinger domain to netlify

How to transfer domain from hostinger to godaddy

How to uninstall wordpress in hostinger

How to connect Godaddy domain to Hostinger

How to host PHP website on Hostinger

How to change server location in Hostinger

How To Host Next JS Website On Hostinger

How to create subdomain in hostinger