How to start a NodeJS process on a remote server?
linux, node.js
Solution
That's not a specific nodejs problem, although there are specific solutions (for example forever).
A generic solution to remotely start any program on linux and not have it die when you close the session is to launch it using nohup. Here's an example in which I launch node and redirect both the standard and error outputs into the `server.log` file :
nohup node main.js >> server.log 2>&1 < /dev/null &
Problem
I've created a simple NodeJS app which I have now moved up to a server in AWS. I'm able to ssh into the server and start the application but obviously as soon as I close the terminal the process stops. How to I start my NodeJS app and keep it running after I've closed my terminal?