Apache modules provide features such as authentication, TLS, and URL rewriting. The loaded-module list shows what the current configuration selects, including compiled-in modules and enabled shared modules; other available module files may remain unused.
Apache includes compiled-in modules whenever that server binary runs and loads shared modules through LoadModule declarations. On Debian and Ubuntu, packaged shared modules are managed through links to module definition files, and a2query reports which of those modules are enabled.
A module dump parses the configuration on disk; it does not query an already-running Apache process. After configuration changes, a successful reload must apply the new module selection before the list represents the serving instance.
Steps to list loaded Apache modules:
- Dump the modules that the current Apache configuration loads.
$ apache2ctl -M Loaded Modules: core_module (static) so_module (static) ##### snipped ##### mpm_event_module (shared) ##### snipped ##### rewrite_module (shared) setenvif_module (shared) socache_shmcb_module (shared) ssl_module (shared) status_module (shared)
-M lists both static (compiled-in) and shared modules selected by this configuration. Use httpd -M on installations that expose the server binary directly. Startup warnings may precede Loaded Modules:; a syntax or permission error means the dump did not complete, and administrator privileges may be needed to read protected configuration or certificate files.
- Show only the modules that are compiled into the server binary.
$ apache2ctl -l Compiled in modules: core.c mod_so.c mod_watchdog.c http_core.c mod_log_config.c mod_logio.c mod_version.c mod_unixd.c mod_systemd.c
The official httpd -l option lists built-in modules only, so shared modules such as mod_rewrite appear in the -M output instead.
- List enabled modules with the Debian and Ubuntu packaging helper.
$ a2query -m rewrite (enabled by site administrator) mime (enabled by maintainer script) autoindex (enabled by maintainer script) alias (enabled by maintainer script) ##### snipped ##### access_compat (enabled by maintainer script) deflate (enabled by maintainer script)
a2query -m reports package-managed enabled modules and shows whether the administrator or package maintainer scripts enabled them. It omits compiled-in modules.
- List the module definition files that Debian and Ubuntu packages make available to enable.
$ ls /etc/apache2/mods-available access_compat.load actions.conf actions.load alias.conf alias.load ##### snipped ##### rewrite.load ##### snipped #####
.load files carry the LoadModule declaration, and matching .conf files add module-specific defaults when the module is enabled. Availability here does not mean the module is enabled.
Related: How to install Apache modules on Ubuntu and Debian - Check the loaded-module list for the module you need.
$ apache2ctl -M | grep -i rewrite rewrite_module (shared)
-M reports the module identifier as rewrite_module, while the Debian-family helper uses rewrite. After a successful module dump, no matching line means the current configuration did not select that module.
Related: How to enable or disable Apache modules