Reputation: 20555
I wasn't quite sure what to call this question but here i go:
i have a remote server
where i have installed node.js
now normally this would be how i start the server:
ssh root@ip
cd /var/www/mydomain/server
nodejs server.js
This works without any issues however what happens when i close down the terminal? How can i make sure that the server doesn't just stop. And how can i control it after i have started it (for instance restarting / stopping it).
Upvotes: 0
Views: 927
Reputation: 1189
There are plenty of solutions here, but maybe the most easy to start with is using forever
.
Forever is a npm module that keep your app running and restarts it if it crashes.
Also there are more advanced solutions, like using PM2, which I recommend, but first take a look at forever.
Upvotes: 1