When I'd use a web server other than Apache
As I mentioned last entry, while I've come around to Apache as my default choice for new web servers there are still situations where I would start with something else. Of course the obvious case is when you've assessed and measured your web site and you've determined that some other web server is the best choice (for whatever reason). Here, I'm interested in more general cases, ones where I haven't done any particular specific measurements and so on.
Right now, there are three general cases where I would reach for something other than Apache:
- if I had a machine with constrained resources. Apache is many
things but it is generally not a lightweight web server. I'm sure
you can make it one if you know exactly the right configuration
options for your specific usage, but I'd rather start with something
that was explicitly designed for that from the start.
- if I wanted the web server to have predictable and limited resource
usage, with a very low chance of blowing up the machine even if it
got hit with unexpected load. You can do this in Apache with the
right configuration options but Apache is sufficiently complex that
just what these options are is not particularly obvious (and you need
not to miss something in the corner). A number of other web servers
are much more predictable, especially ones that do all of their
work in a single process.
(This is generally true even for dynamic content, partly because the other web servers generally require you to run your dynamic code in a way that exposes obvious limits on it. For example, they may require you to run your dynamic code in a separate FastCGI-based server and then the server is highly likely to have a clear configuration setting for things like 'how many processes at once'.)
- if I had a sufficiently simple configuration, generally for static files and other simple things, and I didn't want to pay what I'll call the Apache configuration tax. Apache configuration files are complex and verbose, partly because Apache supports so much and partly because of history. Other web servers often have much simpler single-file configurations, at least in the simple case.
Of course these cases can combine.
(While we use Apache for our serious web servers, we actually have a few trivial ones here that run Lighttpd for a combination of the second and third reasons.)