http-server icon indicating copy to clipboard operation
http-server copied to clipboard

How do I run http-server in the background

Open EvHaus opened this issue 11 years ago • 10 comments

Running:

http-server . &

Doesn't seem to work. It also doesn't play nice with forever or supervisor.

Any other suggestions?

EvHaus avatar Oct 07 '15 03:10 EvHaus

For me, http-server . & works. I just have to press enter once more to get my prompt back. :P

I'm having trouble installing forever right now, but i will let you know if it works for me.

derhuerst avatar Oct 07 '15 09:10 derhuerst

forever start $(which http-server) . works as well for me.

derhuerst avatar Oct 07 '15 10:10 derhuerst

That or

forever start -c http-server

indexzero avatar Oct 07 '15 14:10 indexzero

http-server . > http.log 2>&1 &

ksloan avatar Mar 31 '16 06:03 ksloan

http-server . > http.log 2>&1 &

How do you stop this?

jackdh avatar Jan 14 '19 08:01 jackdh

http-server . > http.log 2>&1 & echo $! > /var/tmp/pidfile pkill --pidfile /var/tmp/pidfile

deepakppatil avatar Jun 18 '19 13:06 deepakppatil

@jackdh

See PID with

$ netstat -nlp

After KILL pid

$ kill 999

andradedpg avatar May 13 '20 18:05 andradedpg

@jackdh kill the process

plh97 avatar Aug 26 '20 03:08 plh97

For those still stuck from Google:

https://stackoverflow.com/questions/47881223/running-http-server-in-background-from-an-npm-script

npm-run-all with --race works best

simonsmith avatar May 17 '23 21:05 simonsmith

nohup http-server . &

mrghasemi1992 avatar Nov 23 '23 15:11 mrghasemi1992