3

I am new to nodejs and digital ocean. I set up a digital ocean droplet and I want to run a node server on my droplet forever. So I ssh into the droplet (Ubuntu) and run node myNodeProgram.js. It works great for a few minutes but whenever the connection drops the node process stops running.

So how do I make it always run?

Nick Manning
  • 2,828
  • 1
  • 29
  • 50
  • look up "run node as a daemon" – fixmycode Sep 22 '15 at 03:12
  • 1
    One of my favorite things about Digital Ocean is [their excellent tutorials](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04) :-) – Marty Sep 22 '15 at 03:13
  • Thanks. I looked that up and found http://stackoverflow.com/questions/4018154/node-js-as-a-background-service – Nick Manning Sep 22 '15 at 03:19

1 Answers1

0

Install pm2 nodejs process manager.

https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

Aswin Av
  • 1
  • 1
  • 3
    A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – Wayne Phipps Feb 06 '19 at 19:38