0
nohup python -m SimpleHTTPServer 80 &

After executing the above command, create a http server http server in linux vps often will automatically be killed(About one to two hours), that is why?


nohup

36.19.96.16 - - [05/Sep/2013 03:20:49] "GET /images/1.jpg HTTP/1.1" 200 - Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
hsb-110-81.hotspotbroadband.com - - [05/Sep/2013 06:39:54] code 400, message Bad HTTP/0.9 request type ('\x80w\x01\x03\x01\x00N\x00\x00\x00')
sottish
  • 125
  • 2
  • 8
  • 1
    What does the traceback say? There should be a `nohup.out` file in the directory where you ran this command. – Blender Sep 08 '13 at 18:22
  • SimpleHTTPServer shouldn't actually be used as a webserver like this. It's single-threaded, slow, and isn't fault-tolerant. If you need a webserver for static resources, use Nginx – Blender Sep 08 '13 at 18:43

1 Answers1

0

Try nohup python -m SimpleHTTPServer 80 &

and also try to debug in nohup.out logs might be some memory constraint it gets killed.

linux_fanatic
  • 4,767
  • 3
  • 19
  • 20
  • error: [Errno 32] Broken pipe I feel as being the pythong SimpleHTTPServer is very slow and it takes few number of seconds to load the page without images.I would suggest that you can use node.js this link can be more helpful too http://stackoverflow.com/questions/12905426/faster-alternative-to-pythons-simplehttpserver – linux_fanatic Sep 08 '13 at 18:57