If you have the go toolchain installed, this is a single ‘go get’ and you have it in your path forever. I found it particularly useful for looking at python coverage results on a headless machine. SimpleHTTPServer simply couldn’t serve the page as it had too many subcomponents; serve-dir served it up in milliseconds. nginx requires writing a config, setting it up as a daemon, and likely running via sudo (or figuring out some way to redirect the logging to non-root locations).
But the whole value of SimpleHTTPServer is its ubiquity.
And if you need speed and are someone with go installed, you could write a one line main anyway:
http.ListenAndServe(":80", http.FileServer(http.Dir(".")))In that case I can just run an nginx though.
That’s absolutely true. I would run nginx or a one line main before I would clone a repo, build it, and so on.
If you have the go toolchain installed, this is a single ‘go get’ and you have it in your path forever. I found it particularly useful for looking at python coverage results on a headless machine. SimpleHTTPServer simply couldn’t serve the page as it had too many subcomponents; serve-dir served it up in milliseconds. nginx requires writing a config, setting it up as a daemon, and likely running via sudo (or figuring out some way to redirect the logging to non-root locations).
All my bet is that native http.FileServer of golang is cache aware which is not the case of SimpleHTTPServer
http://chneukirchen.org/dotfiles/bin/nginx-here (doesnt work with 1.8 yet).
It seems he agrees :)
What’s funny is I found that line on the interwebs, it used to be an example on the net/http godoc.
I use
http-serverfor this purpose. You install it withnpm(Node) instead ofgo. It’s just as simple:http-serverorhttp-server --help.