Apache Modules

Apache is designed in a modular fashion, so that the base server can be a small easily debugged application, while nearly unlimited additional functionality can be added easily by loading additional modules. The base process can then be smaller, and only those additional features that are needed can be loaded. This Webmin module allows you to select the available Apache modules that you'd like to be loaded.

Figure 7-3. Apache Modules

The first module listed in the figure above is mod_so, which is the module that provides shared object loading at run-time. This module is required if you are using run-time module loading and is the only module other than core.c that cannot be a dynamically loaded module. It must be compiled into the Apache binary at build time if you will be using dynamically loaded modules. Dynamic Shared Objects are not supported by all operating systems, currently, but they are supported by the majority of modern systems including Unix variants that support loadable .so libraries and Windows systems in the form of DLLs. There are several other modules in common use listed in the above figure, some of which will be discussed below. A good place to go to find out more about available standard modules and third party modules is Apache modules and Apache Module Registry.

Configured modules are loaded into the Apache process on startup, thus it is possible to add new modules without recompiling the server. The modular nature of Apache is one of it's primary benefits over other webservers. Without modules, Apache would be just another webserver. But because modules are relatively easy to program, the variety available has proliferated, providing functionality for Apache that is unavailable in any other webserver product, commercial or Open Source.

About Apache Modules

Because of the importance modules play in the configuration and management of an Apache webserver, it is worthwhile to step out of Webmin for a short time to discuss some of the lower-level details of Apache and its modules. While the usage of these modules via Webmin is discussed throughout this chapter, an overview of the modules will help put the modular structure of Apache into perspective, and hopefully make clearer the interaction between Webmin and the underlying configuration files.

Note

The official Apache modules documentation page is an informative, and more comprehensive list of modules that are part of the Apache distribution. Only the most commonly used modules and their purposes will be discussed here. A similar page covers the Apache 2.0 modules.

Apache Core

The Apache Core module provides the basic functionality that is required to provide web service as described by RFC 2616. The features in core are always available in any Apache installation, regardless of what other modules are available.

XXX

Multi-Processing Modules

Beginning with Apache version 2.0, a new model (or more accurately, a number of new models) for handling connection concurrency has been added the system. Concurrency in Apache versions prior to 2.0 used a model known as connection-per-process, with some enhancements to that model like pre-forking. New versions provide what are known as Multi-Processing Modules which allows Apache to use the concurrency model that makes the most sense for a give operating system. most Unix and Unix-like systems use a module called worker which implements a hybrid model utilizing a pool of multi-threaded processes.

When the worker module is enabled, Apache runs a single control process that is responsible for launching child processes. The child processes spawn a configurable fixed number of threads each, and these individual threads listen for connections and serve them. Threads are lighter weight, or less resource intensive, than real processes, and thus a machine of a given capacity can provide higher throughput from a worker style Apache than from a traditionl pre-forking Apache. This was a primary motivation in the development of the new Apache 2.0 service modules.

If your Unix variant doesn't support threads, or supports them in an incompatible way, Apache will likely use the prefork model instead. Windows machines will likely use the mpm_winnt Multi-Processing module, which creates a single control process which spawns a child process, which in turn creates threads to handle requests. Since Webmin only runs on Unix-like operating systems at this time, you will likely have no use for the Windows module.

mod_auth

User authentication of several types is supported by Apache. The oldest and most commonly used is supported by this module. It is known alternately as HTTP Basic Authentication or NCSA authentication. This method authenticates users from a plain text file located somewhere on the system. The password file can be generated using the htpasswd program that is included with Apache.

Note

To generate a password file using htpasswd, simply run the program with the -c option, a new filename, and the first username to add to the file:

[joe@delilah mydocs]$ htpasswd -c .htpasswd joe
  

This file can then be used by the mod_auth module to authenticate users based on this file. This must be explicitly configured in the Apache configuration file, or in the local .htaccess file. Creating an .htaccess file is discussed in the tutorial section of this chapter.