how to automatically restart a node server?

Yes, upstart will restart your process without a reboot.

Also, you should look into forever.


PM2 is a Production process manager for Node.js app.


If your focus for automatic restart is an always running application, I suggest to use a process manager. Process manager, in general, handles the node process(es if cluster enabled), and is responsible for the process/es execution. PM leans on the operative system: your node app and the OS are not so strinctly chained because the pm is in the middle.

Final trick: put the process manager on upstart.

Here is a complete performance improvement path to follow.