Choosing Modules

Inclusion of modules is done by uncommenting (removing the leading #) lines in Configuration. The only drawback to including more modules is an increase in the size of your binary and an imperceptible degradation in performance.[12]

The default Configuration file includes the modules listed here, together with a lot of chat and comment that we have removed for clarity. Modules that are compiled into the Win32 core are marked with “W”; those that are supplied as a standard Win32 DLL are marked “WD.” Our final list is as follows:

AddModule modules/standard/mod_env.o

Sets up environment variables to be passed to CGI scripts.

AddModule modules/standard/mod_log_config.o

Determines logging configuration.

AddModule modules/standard/mod_mime_magic.o

Determines the type of a file.

AddModule modules/standard/mod_mime.o

Maps file extensions to content types.

AddModule modules/standard/mod_negotiation.o

Allows content selection based on Accept headers.

AddModule modules/standard/mod_status.o (WD)

Gives access to server status information.

AddModule modules/standard/mod_info.o

Gives access to configuration information.

AddModule modules/standard/mod_include.o

Translates server-side include statements in CGI texts.

AddModule modules/standard/mod_autoindex.o

Indexes directories without an index file.

AddModule modules/standard/mod_dir.o

Handles requests on directories and directory index files.

AddModule modules/standard/mod_cgi.o

Executes CGI scripts.

AddModule modules/standard/mod_asis.o

Implements .asis file types.

AddModule modules/standard/mod_imap.o

Executes imagemaps.

AddModule modules/standard/mod_actions.o

Specifies CGI scripts to act as handlers for particular file types.

AddModule modules/standard/mod_speling.o

Corrects common spelling mistakes in requests.

AddModule modules/standard/mod_userdir.o

Selects resource directories by username and a common prefix.

AddModule modules/proxy/libproxy.o

Allows Apache to run as a proxy server; should be commented out if not needed.

AddModule modules/standard/mod_alias.o

Provides simple URL translation and redirection.

AddModule modules/standard/mod_rewrite.o (WD)

Rewrites requested URIs using specified rules.

AddModule modules/standard/mod_access.o

Provides access control.

AddModule modules/standard/mod_auth.o

Provides authorization control.

AddModule modules/standard/mod_auth_anon.o (WD)

Provides FTP-style anonymous username/password authentication.

AddModule modules/standard/mod_auth_db.o

Manages a database of passwords; alternative to mod_auth_dbm.o.

AddModule modules/standard/mod_cern_meta.o (WD)

Implements metainformation files compatible with the CERN web server.

AddModule modules/standard/mod_digest.o (WD)

Implements HTTP digest authentication; more secure than the others.

AddModule modules/standard/mod_expires.o (WD)

Applies Expires headers to resources.

AddModule modules/standard/mod_headers.o (WD)

Sets arbitrary HTTP response headers.

AddModule modules/standard/mod_usertrack.o (WD)

Tracks users by means of cookies. It is not necessary to use cookies.

AddModule modules/standard/mod_unique_id.o

Generates an ID for each hit. May not work on all systems.

AddModule modules/standard/mod_so.o

Loads modules at runtime. Experimental.

AddModule modules/standard/mod_setenvif.o

Sets environment variables based on header fields in the request.

Here are the modules we commented out, and why:

# AddModule modules/standard/mod_log_agent.o

Not relevant here — CERN holdover.

# AddModule modules/standard/mod_log_referer.o

Not relevant here — CERN holdover.

# AddModule modules/standard/mod_auth_dbm.o

Can’t have both this and mod_auth_db.o. Doesn’t work with Win32.

# AddModule modules/example/mod_example.o

Only for testing APIs (see Chapter 20).

These are the “standard” Apache modules, approved and supported by the Apache Group as a whole. There are a number of other modules available (see http://modules.apache.org).

Although we mentioned mod_auth_db.o and mod_auth_dbm.o earlier, they provide equivalent functionality and shouldn’t be compiled together.

We have left out any modules described as experimental. Any disparity between the directives listed in this book and the list obtained by starting Apache with the -h flag is probably caused by the errant directive having moved out of experimental status since we went to press.

Later on, when we are writing Apache configuration scripts, we can make them adapt to the modules we include or exclude with the IfModule directive. This allows you to give out predefined Config files that always work (in the sense of Apache loading), regardless of what mix of modules is actually compiled. Thus, for instance, we can adapt to the absence of configurable logging with the following:

...
<IfModule mod_log_config.c>
LogFormat "customers: host %h, logname %l, user %u, time %t, request %r, status %s, 
bytes %b"
</IfModule>
...


[12] Assuming the module has been carefully written, it does very little unless enabled in the httpd.conf files.