I have an ubuntu server. On which I have transferred some files which have some js and html code.
I used http-server from node.js to start a web server so that I can display the html page on the server.
I used nohup so that it can remain running even if I disconnect or close my system.
Here is the command I used:
nohup http-server -p 8000 -a 10.4.145.182 &
Now this allows me to visualize the files on 10.4.145.182:8000 but I am noticing after sometime the server goes down and one can't access the html page on that ip in their browser.
I thought nohup is for running things in background even if one closes their system or logs out of server.
So I asked around here and someone suggested using pm2. So got that installed.
As per the suggestion of using pm2, I installed latest version of node and then started service with pm2.
It says service started for http-server but when I go to ip with port 8000 on browser it doesn't open up.
Here is the command I ran in my directory which has the html and d3 files.
$ pm2 start $(which http-server) -p 8000
And here is the output in shell of the pm2
How to run the server forever without getting halted and what's going wrong with pm2?