How to configure Ubuntu 14.04.4 VPS for app in NodeJS?


My query is as follows:

I have an app made on nodeJS and Express, use SocketIO to extract data in real time from Twitter.

What is the procedure to pass my app to a VPS in such a way that when doing sudo reboot my app is run on the specific port (given by the server.listen() ) in Nodejs?

Any link to contribute?

And if I have two or more app in different ports, how do I configure all this?

Thanks for the future answers !!


VPS with Ubuntu 14.04.4

asked by papabomay 17.03.2016 в 03:13

3 answers


Well there are several options, you could use PM2 npm install pm2 -g - > pm2 start app.js , will give you as a small dashboard in the console where you can see if your application is enabled, the pid, status, etc. The other is to use forever or supervisor, although the latter I have not used, with forever technically your application will be running continuously.

answered by 17.03.2016 / 17:36

It has been very useful for me to use this guide: link

And I like it because you can easily raise, lower or restart the service from the command line (if it's a production environment that does not have a graphical interface) and each app is handled separately.

start my-application
status my-application
restart my-application
stop my-application
answered by 04.05.2016 в 19:29

If you are still in production, from the folder you run "node nodescript.js" and that will cause the script to run. For distribution use "forever" that leaves in the background executing the script always on the server.

answered by 17.10.2016 в 10:52