I have a node.js app on an EC2 server but when the server restarts(which it does every two days) the app wasn't starting with it.
I've found an easy solution
By editing the '/etc/rc.local' file you can run a file each time the server starts.
SSH into your server.
Type the below commands:
Add the below text:
Replace index.js with your apps name(appname.js)
To find the location of your node folder type the below command(mine is here '/home/ubuntu/.nvm/versions/node/v7.7.2/bin/node') :
Below is what the file should look like.
Press CTL and X to exit the editor, type 'y' to save and then just press enter when prompted with the file name.
Now restart the server:
Your app will now run each time the server reboots
“You should always waste time when you don't have any. Time is not the boss of you. Rule 408.”