Skip to main content
Bumped by Community user
Bumped by Community user
edited tags
Link
Kusalananda
  • 356.3k
  • 42
  • 737
  • 1.1k
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 9 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 239

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 helpsallows 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 helps runis 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

enter image description here

Any help howHow to run the server forever without getting halted and what's going wrong with pm2?

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 helps me 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 helps run 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

enter image description here

Any help how to run the server forever without getting halted and what's going wrong with pm2?

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

enter image description here

How to run the server forever without getting halted and what's going wrong with pm2?

Source Link
Baktaawar
  • 101
  • 1
  • 3

Running http-server forever on ubuntu server

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 helps me 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 helps run 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

enter image description here

Any help how to run the server forever without getting halted and what's going wrong with pm2?