Search code examples
node.jsserverforevervs-web-site-project

How to make my server available with "forever start server.js"


I have spent multiple hours to try and get my server up and running. As a part of a class assignment we are migrating to ExpressJS. So the instruction go as follows:

  1. Install latest version of nodejs and npm as well as express, morgan,and forever in our ssh server(Ubuntu based).
  2. In our "website" folder we created a "public" folder to throw all web content in.
  3. We then downloaded a server.js script the professor uploaded and we are to place it inside the "website" folder we have.
  4. Then we set the path to the "website" folder. To be clear "website" contains the "public" folder and server.js script.
  5. Write `forever start server.js` in the terminal

Forever processes server.js , but I do not get my website loaded,no matter the browser I access through(the terminal is also open). I tried writing forever list and all processes are stopped. I think the issue might be around here.

I have tried using:

  • forever start ./bin/www -did not work
  • sudo forever start server.js-did not work
  • sudo nohup forever start server.js-did not work
  • nohup forever start server.js-did not work

I really need to figure how to get this server up and running. If you need something from me let me know what and how to get it, please. I am a windows user and more than half of these commands I found researching other questions. If you need logs, or images also, please let me know where to find them to provide them to you since I have little technical knowledge for some of these things. - Thanks!


Solution

  • You can try nodemon for dev. or pm2 for production if you're trying to keep your server running.

    https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/