Apache - phases and handlers

From Helpful
Jump to: navigation, search
Related to web development, hosting, and such: (See also the webdev category)
jQuery: Introduction, some basics, examples · plugin notes · unsorted

Server stuff:

Dynamic server stuff:

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Apache does things in phases - see e.g. this image (from here).

Phases are steps that handle single concepts. Each phase consists usually of one, but possibly multiple handlers. Apache's defaults are usually 'do nothing' (e.g. for authentication) or are very simple things such as returning a file from the file system. In the case of serving files, the phases involved are roughly:

  • Translating the request URI into a file location
  • Read file and send out ('main' phase)
  • Logging the request

Phases and handlers are essentially a transformation chain. Seen another way it is a tree in which the first-deep nodes are phases (their names) and the second level are handlers. Each of the (again, possibly multiple) handlers can ask apache to skip further handlers in the same phase.

Note that authentication may be abbreviated as AuthN (or auth), while authorization is often abbreviated as AuthZ. This is where the separate phases come from. In dynamic systems it's common to do the authorization yourself, and often the authentication as well. Authentication is useful in that the user/password exchange is supported by all serious user agents, and thereby standardized.

All handling (virtual directories, url rewriting, module handling) fit into this model somehow, usually in a single handler, and in some complex setups involving multiple handlers and/or multiple phases (the magical mod_rewrite sits in two phases, for example).