Networking / Beginners

Loading Dynamic Shared Objects

The two directives that appear most in the Red Hat httpd.conf file are LoadModule and AddModule. These two directives make up more than 75 of the 250 active lines in the httpd configuration file. All 75 of these lines configure the Dynamic Shared Object (DSO) modules used by the Apache web server.

Apache is composed of many software modules. Like kernel modules, DSO modules can be compiled into Apache or loaded at runtime. Run httpd with the -l command-line option to lists all of the modules compiled into Apache. Listing below shows the statically linked httpd modules on our sample Red Hat system.

Listing 6.2: Listing Statically Linked httpd Modules
$ httpd -l
Compiled-in modules:
  http_core.c
  mod_so.c

Some systems may have many modules compiled into the Apache daemon. Others, such as the Red Hat Linux 7.2 system, are delivered with only two modules compiled in. These are:

http_core.c This is the core module. It is always statically linked into the Apache kernel. It provides the basic functions that must be found in every Apache web server. This module is required. All other modules are optional.

mod_so.c This module provides runtime support for Dynamic Shared Object modules. It is required if you plan to dynamically link in other modules at runtime. If modules are loaded through the httpd.conf file, this module must be installed in Apache to support those modules. For this reason, it is often statically linked into the Apache kernel.

Red Hat also uses many dynamically loaded modules. Two directives are used in the httpd.conf file to enable dynamically loaded modules. First, each module is identified by a LoadModule directive. For example, to request the module that handles the user agent log file, enter this line in the httpd.conf file:

LoadModule agent_log_module modules/mod_log_agent.so

The LoadModule directive is followed by the module name and the path to the module itself.
In addition to the LoadModule directive, the Red Hat configuration identifies each module with an AddModule directive. This adds the module name to the list of modules that are actually loaded at runtime. The module list includes all optional modules-those that are compiled into the server and those that are dynamically loaded-except for the core module, which is not optional. For example, to add the agent_log_module to the module list, add the following line to the httpd.conf file:

AddModule mod_log_agent.c

The AddModule directive is followed by the source filename of the module being loaded. It is not the module name seen on the LoadModule line; it is the name of the source file that produced the object module, which is identical to the object filename except for the extension. On the LoadModule line, the object filename is mod_log_agent.so. Here, the source filename is mod_ log_agent.c. Executable modules, called shared objects, use the extension .so, and the C-language modules in the add list use the extension .c.

Table below lists the modules that Red Hat Linux 7.2 identifies in its sample httpd.conf file with AddModule directives.

Table below: DSO Modules Loaded in the Red Hat Configuration

Module 			Purpose
mod_access 		Specifies host- and domain-based access
                        controls.
mod_actions 		Maps a CGI script to a MIME file type.
mod_alias 		Points to document directories outside the
                        document tree.
mod_asis 		Defines file types returned without headers.
mod_auth 		Enables user authentication.
mod_auth_anon 		Enables anonymous logins.
mod_auth_db 		Enables use of a DB authentication file.
mod_autoindex 		Enables automatic index generation.
mod_bandwidth 		Sets bandwidth limits on server usage.
mod_cgi 		Enables execution of CGI programs.
mod_dav 		Provides WebDAV protocol extensions.
mod_dir 		Controls formatting of directory listings.
mod_env 		Allows CGI and SSI to inherit all shell
                        environment variables.
mod_expires 		Sets the date for the Expires header.
mod_headers 		Enables customized response headers.
mod_imap 		Processes image map files.
mod_include 		Processes SSI files.
mod_info 		Enables use of the server-info handler.
mod_log_agent 		Points to the agent log file.
mod_log_config 		Enables use of custom log formats.
mod_log_referer 	Points to the referer log, which logs
                        information about remote sites that
                        refer to your site.
Module 			Purpose
mod_mime 		Provides support for MIME files.
mod_negotiation 	Enables MIME content negotiation.
mod_perl	 	Provides support for the Perl language.
mod_php 		Provides support for the PHP language.
mod_php3 		Additional PHP support.
mod_php4 		Additional PHP support
mod_put 		Provides support for client to server file
                        transfers using the PUT and DELETE commands.
mod_python 		Provides support for the Python language.
mod_rewrite 		Enables URI-to-filename mapping.
mod_roaming 		Provides Netscape Roaming Access support.
mod_setenvif 		Sets environment variables from client
                        information.
mod_so 			Provides runtime support for shared objects
                        (DSO).
mod_ssl 		Provides support for Secure Sockets Layer.
mod_status 		Provides web-based access to the server-info
                        report.
mod_throttle 		Limits the maximum usage of individual users.
mod_userdir 		Defines where users can create public web
                        pages.
mod_vhost_alias 	Provides support for name-based virtual hosts.

In addition to the LoadModule and AddModule directives, the Red Hat httpd.conf file contains one other directive that relates to loading DSOs. Before the modules are added to the list of modules that are available to Apache, the old module list can be cleared with the ClearModuleList directive. ClearModuleList occurs in the Red Hat httpd.conf file after the last LoadModule directive and before the first AddModule directive.

[Previous] [Contents] [Next]