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

Some example modules for Apache are PHP which provides support for hosting PHP scripts on Apache, and WSGI, which enables support for hosting Python web applications.

Common Apache modules in Linux are available in the official package repository of the default package manager. It makes it very easy to install most Apache modules in Linux.

Steps to install Apache modules:

  1. List available Apache modules for your distribution.
    $ sudo apt search libapache2-mod- #Ubuntu and Debian
    [sudo] password for user:
    Full Text Search... Done
    libapache-mod-jk-doc/jammy/en 1:1.2.46-1 all
      Documentation of libapache2-mod-jk package
    libapache2-mod-apparmor/jammy/en 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.