My 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 se…
Big list of HTTP static server one-liners
61–70 of 100 posts
Re: Big list of HTTP static server one-liners
#62Note that a lot of these bind to 0.0.0.0 by default. This has caused me surprises in the past as I was failing to connect to a host that is available over IPv6. Sometimes it was even intermittent as I would sometime resolve to the IPv4 and sometimes get the IPv6 and fail. For python3 this is easily remedied. python -m http.server -b :: On most OS configurations this will listen on both IPv4 and IPv6. Or for when you…
For the use cases of most of that software list, they should actually listen to localhost (127.0.0.1 and ::1) only, because security. Listening on every IPv6 interface, which might be exposed directly on the IPv6 internet, is even a worse idea.
Re: Big list of HTTP static server one-liners
#63My 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 se…
Re: Big list of HTTP static server one-liners
#64Isn't python's server blocking? If you make two requests simultaneously, one of them will have to wait.
Re: Big list of HTTP static server one-liners
#65[1] https://github.com/tngranados/dotfiles/blob/0ebdc12f2454061a...
Re: Big list of HTTP static server one-liners
#66My 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 se…
Because the point is that I want a webserver up now . If I was running something long-term I would just use Caddy anyway.
I don't particularly care about what's least likely to fall over under sustained load or is suitable security wise to expose to the internet, because it's not going to have to deal with either of these things. Being "already installed" on the other hand is a big selling point.
Re: Big list of HTTP static server one-liners
#67Weird to call these one liners, they're just invocation commands. By that logic, apache is a one-liner.
The point is that there is a working http server already installed on your machine. And you just need to run this one simple, memorable command to use it.
Very useful if you just want to quickly copy some files from A to B in your LAN or WAN (wouldn't use it over Internet because not encrypted).
Re: Big list of HTTP static server one-liners
#68Re: Big list of HTTP static server one-liners
#69Re: Big list of HTTP static server one-liners
#70$ 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.
Does emrun allow CORS, required for SharedArrayBuffers?
I wonder how come CORS is such a misunderstood concept globally. It's a really simple concept in general, and understanding it will make a lot of your work as a frontend/full stack developer easier. Take a day and fully understand it, it'll pay off.