Sthttpd: Tiny and fast http server with a mature codebase
github.com
github.com
https://github.com/rmdir/sthttpd
"sthttpd is a fork of Jef Poskanzer's popular thttpd server. This fork aims to simply maintain the original codebase as bugs or security issues are found."
It runs on more platforms and uses a tiny amount of memory. It also predates nginx so there's probably some legacy sites that are still using it.
Over a decade ago, I have used thttpd to serve static files as:
1) nginx didn't exist
2) thttpd is tiny (thttpd binary size is ~50KB vs nginx's ~2.8MB) which is good on embedded or very old hardware for example.
3) Memory footprint of thttpd is around 10KB. nginx doesn't even come close
Nginx certainly is some kick-ass piece of software, but as every other software, it doesn't suit 100% of users 100%. There are valid reasons to choose different HTTP servers over Nginx, as people in this thread already pointed out.
To give another example, the OpenBSD project, famously obsessed about code quality, recently removed Nginx from the base system, not least because they think its code is "über-optimized," possibly eliminating OS-level security mechanisms. [1] This doesn't mean that the code bad, but some people prefer "tiny" and clearly-written codebases that can be audited in reasonable time. thttpd, in particular, seems to hold the balance between code size and performance very well, which makes it a nice choice for embedded systems.
[1] <http://undeadly.org/cgi?action=article&sid=20140827065755&pi...
While I do see the need for both small and big servers, this one has support for cgi, and via cgi ssi -- so it's not entirely accurate to say "purely for static files" (as far as I can tell, there's no easy way to completely remove cgi support via the ./configure script -- I could be wrong).
As others have mentioned, openbsd transitioned to a new httpd based off of relayd. Not sure if/how one might compile that for Linux -- I'm not familiar enough with how openbsd organizes its code. I figured out one could get the relevant source with:
cvs -d anoncvs@anoncvs.ca.openbsd.org:/cvs get src/usr.sbin/httpd/
but as far as I can tell, there is no support for any OSs other than openbsd at this time. I'd love to be wrong, but "httpd" (where "httpd" is supposed to be not apache httpd, but new openbsd httpd, which as far as I can tell, is just called, "httpd") isn't very easy to search for...Anyway, openbsd httpd has support for fast-cgi -- so a truly simple server, would be something like: