Running http-server forever on ubuntu server
Clash Royale CLAN TAG#URR8PPP
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?
linux ubuntu node.js
|
show 2 more comments
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?
linux ubuntu node.js
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
1
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56
|
show 2 more comments
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?
linux ubuntu node.js
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?
linux ubuntu node.js
linux ubuntu node.js
edited Feb 25 at 19:15
Rui F Ribeiro
41.6k1483141
41.6k1483141
asked Feb 25 at 18:57
BaktaawarBaktaawar
1012
1012
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
1
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56
|
show 2 more comments
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
1
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
1
1
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56
|
show 2 more comments
1 Answer
1
active
oldest
votes
If you don't care about the consequences you just want to do something like this...
#!/bin/bash
while sleep 5; do
http-server -p 8000 -a 10.4.145.182
wait
done
Then name the script, give it execution permission, so you can kill script when you dont want the "server" to keep being restarted. It theorically only restart the server, when it ends.
This will just answer your question but using a systemd unit as suggested in the comments, it is a lot better.
Here some examples of a auto-restarting unit for systemd:
https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
|
show 3 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502967%2frunning-http-server-forever-on-ubuntu-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you don't care about the consequences you just want to do something like this...
#!/bin/bash
while sleep 5; do
http-server -p 8000 -a 10.4.145.182
wait
done
Then name the script, give it execution permission, so you can kill script when you dont want the "server" to keep being restarted. It theorically only restart the server, when it ends.
This will just answer your question but using a systemd unit as suggested in the comments, it is a lot better.
Here some examples of a auto-restarting unit for systemd:
https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
|
show 3 more comments
If you don't care about the consequences you just want to do something like this...
#!/bin/bash
while sleep 5; do
http-server -p 8000 -a 10.4.145.182
wait
done
Then name the script, give it execution permission, so you can kill script when you dont want the "server" to keep being restarted. It theorically only restart the server, when it ends.
This will just answer your question but using a systemd unit as suggested in the comments, it is a lot better.
Here some examples of a auto-restarting unit for systemd:
https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
|
show 3 more comments
If you don't care about the consequences you just want to do something like this...
#!/bin/bash
while sleep 5; do
http-server -p 8000 -a 10.4.145.182
wait
done
Then name the script, give it execution permission, so you can kill script when you dont want the "server" to keep being restarted. It theorically only restart the server, when it ends.
This will just answer your question but using a systemd unit as suggested in the comments, it is a lot better.
Here some examples of a auto-restarting unit for systemd:
https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/
If you don't care about the consequences you just want to do something like this...
#!/bin/bash
while sleep 5; do
http-server -p 8000 -a 10.4.145.182
wait
done
Then name the script, give it execution permission, so you can kill script when you dont want the "server" to keep being restarted. It theorically only restart the server, when it ends.
This will just answer your question but using a systemd unit as suggested in the comments, it is a lot better.
Here some examples of a auto-restarting unit for systemd:
https://singlebrook.com/2017/10/23/auto-restart-crashed-service-systemd/
edited Feb 25 at 20:29
answered Feb 25 at 20:05
Luciano Andress MartiniLuciano Andress Martini
4,0951136
4,0951136
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
|
show 3 more comments
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
Thnx for ans. I care abt the right thing. I am just asking if it is systemed, if someone can help with the steps that wud be appreciable. I am not a devops person, so these things are a bit difficult for me to do all by myself without some steps guidance. Thnx
– Baktaawar
Feb 25 at 20:14
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
This is the bad about systemd, sometimes it allows you to do some crap thinking you are doing the right thing. If you are really concerned about it, you need to fix the server to do not require auto-restarting anymore. So sorry, can't help anymore, but I think you will find someone that can.
– Luciano Andress Martini
Feb 25 at 20:17
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
Can u pls highlight the steps to start a web server on ubuntu server running untill stop explicitly? I have been askin this simple ques and everyone is busy giving comments with no sols. If you can help ans I wud appreciate. These comments are fine but don't help me in achieving what I want to get done
– Baktaawar
Feb 25 at 20:19
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
#systemctl start apache2 ? You mean your web server right? Not a web server
– Luciano Andress Martini
Feb 25 at 20:22
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
I have node.js installed. I also have http-server installed. How can i run http-server forever. Pls see the ques I added. It tells what I am trying to do
– Baktaawar
Feb 25 at 20:23
|
show 3 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502967%2frunning-http-server-forever-on-ubuntu-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should be starting your server as a daemon, the nohup thing is a total red herring, that's just some notion you picked up somewhere that is not related to what you want to achieve. I believe the normal use for nohup is to execute a specific command after logout, that's how I've used it in my programs, it's not intended to run and maintain a process in the manner of a daemon/server that starts on startup and stops on shutdown.
– Lizardx
Feb 25 at 19:32
sure. So I am using pm2 for that. But getting issues with pm2 itself
– Baktaawar
Feb 25 at 19:48
Why are you wasting time with these 3rd party things like pm2, if you use systemd, create a new service, and it will just run. pm2 isn't even in debian, I assume that's some ubuntu thingie. Just do it the real way, start the daemon on boot, stop it on halt, skip all these other things. Search for: how to start service systemd if you use systemd, if it's old ubuntu, upstart, otherwise, sysv if it's really old.
– Lizardx
Feb 25 at 19:52
I understand ur concern. However I am not a devops guy. I am more into ml stuff. I need to run a d3 visualiztion and html file running on an ubuntu server we have access to. So I asked here and ppl suggested use pm2 or Forever. They said it's hassle free and keeps running even when u r logged out of server. I want the ip on the browser to keep running for other to access the viz. If u can spare some time and help me with the steps for the process u r mentioning, wud be glad to learn and follow those. Thnx.
– Baktaawar
Feb 25 at 19:54
1
Lol, sorry, no. When you use these non core tools to achieve what are standard actions, then hit a bug, or failure, you simply have one more layer to work through to solve the problem, I don't see how that can be considered 'easier'. Starting a daemon / server is easy, just search for it. If this were actually easier, then it would be working, and you wouldn't be stuck trying to figure out why using the wrong tools for the job created more headaches. So maybe the advice you got wasn't so great?
– Lizardx
Feb 25 at 19:56