Work with Apache modules

The httpd service is a modular application, and you can extend it with several Dynamic Shared Objects (DSO). You can dynamically load or unload DSO modules at runtime as necessary. You can find these modules in the /usr/lib64/httpd/modules/ directory.

Load a dynamic shared object module

To configure the functionality for the Apache HTTP Server, you can load Dynamic Shared Object (DSO) modules. Use the LoadModule directive to load a particular DSO module. A separate package has modules with their own configuration file stored in the /etc/httpd/conf.modules.d/ directory.

Before you begin

  • You have installed the httpd package.

Procedure

  1. Search for the module name in the configuration files in the /etc/httpd/conf.modules.d/ directory:
    # grep mod_ssl.so /etc/httpd/conf.modules.d/
  2. Uncomment the LoadModule directive of the module in the configuration file where the module name is present:
    LoadModule ssl_module modules/mod_ssl.so
  3. If the module does not exist, create a configuration file, such as /etc/httpd/conf.modules.d/30-example.conf with the following directive:
    LoadModule ssl_module modules/<custom_module>.so

    For example, a Red Hat Enterprise Linux (RHEL) package does not include the module.

  4. Restart the httpd service:
    # systemctl restart httpd

Results

  • Verify that the module is loaded and enabled:
    # httpd -M | grep ssl

Compile a custom Apache module

You can create your own module and build it by using the httpd-devel package. This package includes header files, include files, and the Apache Extension (apxs) utility, which is required to compile a module.

Before you begin

  • You have the httpd-devel package installed.

Procedure

Build a custom module:
# apxs -i -a -c module_name.c

Results