Knowing which Apache modules are loaded helps diagnose unexpected behavior (authentication prompts, missing URL rewrites, compression issues) and reduces risk by spotting unneeded features that expand the attack surface.
When Apache starts (or performs a graceful reload), it reads its configuration and loads functionality from modules that are either compiled into the server binary or loaded as shared objects via LoadModule directives. On Debian-based systems such as Ubuntu, shared-module management is typically expressed as .load and .conf files under /etc/apache2/mods-available, with symlinks under /etc/apache2/mods-enabled controlling what is active.
Loaded modules and available module files are not the same thing: apache2ctl -M shows only what is currently loaded into the running configuration, while directory listings show what could be enabled. Changing shared modules usually requires a configuration reload or service restart, and some modules may be pulled in indirectly by enabled sites or included configuration snippets.
Related: Default Apache Configuration Files
Related: How to Enable and Disable Apache Modules
Related: How to test Apache configuration
Steps to list installed, enabled, or disabled Apache modules:
- List all loaded Apache modules with their load type.
$ apache2ctl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (shared) ##### snipped ##### rewrite_module (shared)
Module marker Meaning static Compiled into the Apache server binary and always present. shared Loaded from a shared object via a LoadModule directive and typically requires a reload or restart to change. On some systems, the equivalent command is apachectl -M or httpd -M.
- Filter the loaded module list for a single module name.
$ apache2ctl -M | grep -i rewrite rewrite_module (shared)
a2query uses the short name (rewrite), while apache2ctl -M reports the loaded symbol (rewrite_module).
- List module definition files that are available to enable on Debian-based systems.
$ ls /etc/apache2/mods-available access_compat.load alias.conf alias.load auth_basic.load ##### snipped ##### rewrite.load
.load files typically contain LoadModule lines, and matching .conf files (when present) provide module-specific defaults; enabling usually creates symlinks under /etc/apache2/mods-enabled.
Red Hat family systems commonly use /etc/httpd/conf.modules.d for module config and /etc/httpd/modules for module shared objects.
- List available and enabled module definition files in one view on Debian-based systems.
$ ls /etc/apache2/mods-* /etc/apache2/mods-available: access_compat.load actions.conf actions.load alias.conf alias.load ##### snipped ##### /etc/apache2/mods-enabled: access_compat.load alias.conf alias.load auth_basic.load ##### snipped #####
- Confirm a module is enabled by checking for its symlink under /etc/apache2/mods-enabled.
$ ls -l /etc/apache2/mods-enabled/rewrite.load lrwxrwxrwx 1 root root 29 May 13 10:15 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load
- List module status with a2query for a human-readable summary.
$ a2query -m rewrite (enabled by site administrator) reqtimeout (enabled by maintainer script) env (enabled by maintainer script) deflate (enabled by maintainer script) ##### snipped #####
- Confirm the status of a specific module using a2query.
$ a2query -m rewrite rewrite (enabled by site administrator)
- Locate the LoadModule directive that loads a shared module.
$ grep -R --line-number "LoadModule rewrite_module" /etc/apache2/mods-enabled/*.load /etc/apache2/mods-enabled/rewrite.load:1:LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Editing files under /etc/apache2/mods-enabled edits symlinks; change the corresponding file under /etc/apache2/mods-available to keep module management consistent.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.
