Apache HTTP Server – Why Is It So Complex?

apachechttp

The Apache HTTP server is a fairly large project—much larger than, say, lighthttp or nginx or certainly the "simple HTTP servers" you see floating around in C/C++ tutorials.

What is the extra code for? Does it add security/stability (and if so, how?) or is it just for doing things like parsing Apache conf files/.htaccess type things (and, I guess, VirtualHosts etc).

I ask not to critique Apache, but because I'm interested in writing a web server of sorts and I'd like to know things that, while perhaps not obvious, are important to remember for a secure, stable and fast web server.

Best Answer

It's a lot more complex because:

  • it's older,
  • it's got a larger of feature-set (Feature Set Comparison),
  • it's modular,
  • it's got a wider platform support (OS Support Comparison),
  • it's got multiple modes of operation (multi-process, multi-thread, etc...).

But also:

  • It's more actively developed (Status Comparison. As of today 2011-05-28, Apache httpd has the most recent update, though its inherent release process should be hampered by its extended complexity as opposed to its competitors.)

That being said, R.'s answer contains valid points about its architecture and why some other web-servers benefit of relative fame as well. It depends on what you want.

You may also want to look at https://stackoverflow.com/questions/475386/apache-vs-nginx-vs-lighttpd-which-is-simpler-to-configure-and-administer for some more material. Though not directly answering your question, the whole thread points out a lot of differences.


If interested in writing a web server from scratch, I'd say studying Apache httpd is a good thing, especially if you can look back at how it evolved over time. It also shows you what you need to avoid (both on points it addressed well, and places where it's outperformed by others). However, the code might be a bit complex to start with and you might prefer to look at smaller, more light-weight servers for that. But do study its overall architecture and compare it with others.

Related Topic