Apache is a very capable web server, and could be made more capable with the use of modules. Modules extend the capability of Apache and could be enabled or disabled depending on your requirement.

Some of the example modules for Apache are PHP which provide support for hosting PHP scripts on Apache and WSGI which enable support for hosting Python applications.

Most commonly used Apache modules are available in the default package repository of a distribution thus could easily be installed using the distribution's default package manager.

Steps to install Apache modules:

  1. List installable Apache modules modules for your distribution.
    $ sudo apt search libapache2-mod- # Ubuntu and Debian
    [sudo] password for user:
    Full Text Search... Done
    libapache-mod-jk-doc/eoan 1:1.2.46-1 all
      Documentation of libapache2-mod-jk package
    libapache2-mod-apparmor/eoan 2.13.3-5ubuntu1 amd64
      changehat AppArmor library as an Apache module
    ##### snipped
    $ sudo yum search mod_ # CentOS, Fedora and Red Hat
    [sudo] password for user:
    ============================== Name Matched: mod_ ==============================
    mod_md.x86_64 : Certificate provisioning using ACME for the Apache HTTP Server
    mod_ssl.x86_64 : SSL/TLS module for the Apache HTTP Server
    mod_ldap.x86_64 : LDAP authentication modules for the Apache HTTP Server
    ##### snipped
    > sudo zypper search apache2-mod # openSUSE and SLES
    [sudo] password for user:
    Loading repository data...
    Reading installed packages...
    S | Name                     | Summary                               | Type   
      | apache2-mod_apparmor     | AppArmor module for apache2           | package
      | apache2-mod_auth_gssapi  | GSSAPI Module for Apache              | package
      | apache2-mod_auth_openidc | Apache2.x module for an OpenID Conn-> | package
      | apache2-mod_authn_otp    | Apache module for one-time password-> | package
    ##### snipped
  2. Install required Apache modules for your distribution.
    $ sudo apt install --assume-yes libapache2-mod-security2 # Ubuntu and Debian
    $ sudo yum install --assumeyes mod_security # CentOS, Fedora and Red Hat
    > sudo zypper install apache2-mod_php7 # openSUSE and SLES

    Some Apache modules such as for PHP will be installed by default by installing the main package (PHP in this example) in distributions such as CentOS and Red Hat derivatives.

  3. Enable installed modules if it's not automatically enabled.
  4. Restart Apache to start using the installed module.
Discuss the article:

Comment anonymously. Login not required.