Configuration Philosophy
Web Servers Fundamentals
Chapter 3 · Configuration Philosophy
Chapter 2 closed on the idea that concurrency architecture no longer meaningfully separates Apache from Nginx — the real, lasting differentiator is how each server expects to be configured. This chapter covers that directly: Apache's per-directory override model, Nginx's deliberately centralized approach, and IIS's GUI/XML system, which turns out to sit closer to Apache's own philosophy than Nginx's.
Apache's Directory-Context Config & .htaccess
Apache's main configuration lives in a central file (httpd.conf or apache2.conf, depending on distribution), but it also supports .htaccess files — small config files placed directly inside a served directory, whose settings apply to that directory (and its subdirectories) without touching the main config or restarting the server. This is genuinely useful in shared-hosting scenarios, where individual users need to override behavior for their own directory without root access to the main config. The cost: on every single request, Apache must check every parent directory of the requested path for a .htaccess file, unless this checking is explicitly disabled — a real, measurable per-request filesystem cost in exchange for that flexibility.
Nginx's Centralized, No-Runtime-Override Config
Nginx deliberately has no equivalent to .htaccess. All configuration lives in nginx.conf (commonly split across multiple files pulled in via include directives), and any change requires editing that central configuration and reloading the server. There is no per-directory file Nginx checks at request time — which is exactly the point: this avoids the filesystem-scanning overhead Apache's override mechanism incurs on every request, in exchange for requiring deploy-level access to make any configuration change at all, rather than a lighter-weight per-directory override.
IIS's GUI/XML Config
IIS is configured primarily through the IIS Manager GUI, which is itself a front end over XML configuration files — a machine-wide applicationHost.config, plus, notably, its own per-directory override mechanism: web.config files, which can live inside an individual application's own directory and override settings without touching the machine-wide config. Structurally, this makes IIS closer in spirit to Apache's directory-context model than to Nginx's centralized one, even though IIS's own tooling (a GUI, XML rather than plain-text directives) looks nothing like either of the other two on the surface.
| Apache | Nginx | IIS | |
|---|---|---|---|
| Config format | Plain-text directives | Plain-text directives | XML, via a GUI |
| Per-directory override | Yes — .htaccess | No — centralized only | Yes — web.config |
| Change takes effect | Immediately (per-request check) | After a config reload | Immediately for web.config; a full config change may need an app pool recycle |
| Per-request overhead | Filesystem scan for override files | None — config is fixed at reload time | Filesystem scan for web.config, same trade-off as Apache |
Hands-On Exercises
A hosting company gives each of its 500 customers their own directory on a shared Apache server, and wants each customer to be able to set their own custom redirect rules without contacting support. Explain why .htaccess is a good architectural fit here, and what the performance trade-off is for making this possible.
📄 View solutionA team runs Nginx and manages its configuration entirely through version-controlled files deployed via an automation tool. Explain why Nginx's lack of a .htaccess-style override mechanism is actually a good fit for this team's workflow, rather than a missing feature.
📄 View solutionExplain why IIS's web.config mechanism is architecturally closer to Apache's .htaccess model than to Nginx's centralized config, despite IIS looking completely different from Apache on the surface (a GUI and XML vs. plain-text directives).
📄 View solutionChapter 3 Quick Reference
- Apache — central config plus optional per-directory
.htaccessoverrides, at the cost of a per-request filesystem scan - Nginx — one central config only, no per-directory override, no per-request scan overhead, changes require a reload
- IIS — GUI/XML tooling on the surface, but
web.configgives it the same per-directory override capability as Apache's.htaccess - Neither philosophy is "better" — they fit different operating assumptions about who needs to make changes and how