How To Get NodeJS Service Continuous Uptime - One of the problems that NodeJS developers often get is that the service is not uptime continuously. Then how to keep NodeJS service uptime 24 hours? In this guide, we will explain how to make NodeJS services uptime continuously.

Remember, the NodeJS feature is only available on Super Hosting Packages and above !

How To Get NodeJS Service Continuous Uptime

In order for the script that has been created berjalan secara terus menerus, you can use the one Forever.jsthat can be downloaded for free at https://github.com/foreverjs/forever .
how to make the nodejs service uptime continuously
Forever.js ini berfungsi untuk menjaga agar proses Node.js tetap berjalan. If the service shuts down suddenly, the Node.js service will automatically restart. As for step by step using forever.js, namely,

1. Perform SSH access

Please akses server/ hosting yang anda miliki melalui SSH. For SSH remote processing, you can use the Linux terminal or Putty Software on Windows. For those who don't know, please follow the SSH Access Method on cPanel Hosting

2. Go to the Node.js Folder

After that, the masuk ke direktori/ folder tempat dimana aplikasi/ script Node.js berada. You need to do a few terminal commands to change directories. Please type cd (space) in the Node.js script folder . For example, in this tutorial the Node.js script is located in the node folder. Then the terminal can be written cd node /.
how to make the nodejs service uptime continuously

3. Download Forever.js

If it is already in the Node.js script directory / folder, the next thing is melakukan download Forever.js. As for the method, please type

npm install forever

Wait for the installation process to succeed.
how to make the nodejs service uptime continuously

4. Run Forever.js

Now is the time to start the Forever.js service. Untuk menjalankan Forever.jsplease write the following command. Keep in mind that Forever.js can only run when you are in the Node.js script (application) folder / directory!

./node_modules/forever/bin/forever start hello.js

In this example, hello.js is a Node.js script (application). So, in order for the script to continue running, you have to run the Forever.js service in this way.
how to run nodejs on hosting

To find out the error_log, please add a command

 

./node_modules/forever/bin/forever -o out.log -e err.log hello.js

Also Read: How to Set NodeJS Easy and Suitable for Beginners

Running NodeJS with PM2

Apart from using Foreverjs, you can also use PM2 so that the NodeJS service can continue. Please read How to Set NodeJS Using PM2

Conclusion

One way to make NodeJS service uptime continuously is using forever.js. You can download forever.js for free. Once downloaded, make sure the forever.js service can be run properly. Want to try a NodeJS based Ghost application? Please follow How to Install Ghost on Hosting . Do you want to upgrade your hosting? Please check KincaiHosting Best Hosting .

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.