Big list of HTTP static server one-liners
gist.github.com
Big list of HTTP static server one-liners
1–10 of 100 posts
Re: Big list of HTTP static server one-liners
#2There is also devd: [1]
devd .
[1]: https://github.com/cortesi/devdRe: Big list of HTTP static server one-liners
#3What's a good one that serves gzip assets if they exist? I'm looking for a way to serve a webpack prod build.
Re: Big list of HTTP static server one-liners
#4Wow, didn't realize this was started in 2013
Re: Big list of HTTP static server one-liners
#5$ emrun --port 8000 . # Handles WASM; most others don't.[1]
[1] Emscripten's emsdk includes emrun, which actually serves WASM files with the correct MIME type out-of-the-box, unlike the python2 and python3 servers and most others.
Re: Big list of HTTP static server one-liners
#6The ruby one with the -run option is a bit nonintuitive in how it works.
$ ruby -run -ehttpd . -p8000
The -r option requires un.rb[1] which is a file full of convenience functions, such as httpd in this example. Classic Ruby.Given that go has popularized long args with a single hyphen (-name etc), it is easy to mistake -run as an option by itself.
Re: Big list of HTTP static server one-liners
#7I'm always surprised that nginx doesn't have a nice way to run as a single-liner command.
Re: Big list of HTTP static server one-liners
#8Some of these are multi-liners that can be converted to one-liners. For example I believe "npx" can be used for all the node examples for example "npx http-server -p 6007 ./root"
[edit] ahh i see this is called out in the gist comments
Re: Big list of HTTP static server one-liners
#9Is there a way of doing that in a Windows without installing anything?
Re: Big list of HTTP static server one-liners
#10My favourite is thttpd [1] which is super tiny, battle-tested and actually meant for the job (and only this job). It's available as a package on most Linux distros.
Serving a static folder `/static` on port `3000` as user `static-user` and with cache headers set to 60 seconds would go like this:
thttpd -D -h 0.0.0.0 -p 3000 -d /static -u static-user -l - -M 60
Even if you've got Python lying around on every Ubuntu server, I still don't get why you wouldn't use something leaner to serve your static files, as long as it's easy to install/configure. Same goes for most of the runtimes in that list.