title: How do I leave Node.js server on EC2 running forever?
body: <p>As you can tell by my question, I'm new to this...</p>
  
  <p>I built my first website, I set up my first Node.js server to serve it and then pushed everything live on EC2.</p>
  
  <p>I tested everything on my EC2 IP address and everything seems to be working.</p>
  
  <p>Now up until now, I've been testing my app locally so it makes sense that whenever I closed the terminal, app.js would stop running so nothing would be served on localhost.</p>
  
  <p>Now that my server is on EC2, the same thing happens ("obviously" one could say..) whenever I close my terminal.</p>
  
  <p>So my question is how do I keep my Node.js server running on EC2 for like... forever..so that my site stays live.. forever :)</p>
  
  <p>I read something about a node module called "forever" but I'm wondering (being new and all..) why isn't this "forever" functionality a default setting of the Node.js-EC2 system ?</p>
  
  <p>I mean, correct me if I'm wrong, but isn't the whole point of setting up a web server and pushing it live to have it stay live forever? Isn't that what servers are supposed to do anyway (infinitely listening for requests) ? And if that's the case why do we need extra modules/settings to achieve that ?</p>
  
  <p>Thanks for your help.. As you can tell I'm not only looking for a solution but an explanation as well because I got really confused.. :-) </p>
  
  <p><strong>EDIT</strong> (a few details you might need) - After installing my app on EC2 these are the steps that I follow on the terminal (The app is running on <code>Amazon Linux</code> by the way) :</p>
  
  <ul>
  <li><p>I type ssh -i xxxxxxxxxxx.pem ec2-user@ec2-xx-xx-xx-x.eu-west-1.compute.amazonaws.com on the
  terminal</p></li>
  <li><p>After logging onto the Amazon machine I then go to the relevant folder and execute node app.js</p></li>
  <li><p>There are 3 folders in the machine : <code>node</code>, <code>node_modules</code> and <code>*name of my app*</code></p></li>
  <li><p><code>app.js</code> resides in <code>*name of my app*</code></p></li>
  <li><p>After that, the site goes live on my EC2 IP</p></li>
  <li><p>Once I close the terminal, everything is switched off</p></li>
  </ul>