How to view a list of modules in Apache
Apache is a popular open-source web server that supports various functionalities through the use of modules. Modules can provide additional features such as URL rewriting, security mechanisms, caching, and more.
Managing Apache modules involves knowing which modules are installed, enabled, or available within your system. This is crucial for optimizing your server's performance and ensuring that you have the necessary components for running specific web applications.
Whether you're troubleshooting a problem or planning to install new modules, having a complete understanding of what's currently running on your Apache server is vital. In this guide, we'll cover the steps to list installed, available, or enabled Apache modules in different environments. Ubuntu for example uses apachectl and a2query while Red-Hat based distro uses httpd and does not have a2query.
Steps to list installed, enabled or disabled Apache modules:
-
List modules that are enabled or currently active.
$ apache2ctl -M Loaded Modules: core_module (static) so_module (static) ... rewrite_module (shared)
Module Type Description Static These are the modules that are compiled directly into the main httpd binary. They are always present and do not need to be loaded separately. The main advantage is performance, but the drawback is that adding or removing a static module requires recompiling Apache. Shared Shared modules are compiled as separate shared objects. They can be loaded or unloaded at runtime using directives in Apache's configuration file without recompiling the entire Apache binary. This makes adding or removing functionality more flexible. Dynamic These are similar to shared modules but are generally used to refer to modules that can be loaded or unloaded at runtime without a server restart. Typically, modern Apache installations use shared modules in place of truly dynamic ones. Related: Default Apache Configuration Files
Related: How to Enable and Disable Apache Modules -
Filter for specific module using grep.
$ apache2ctl -M | grep rewrite rewrite_module (shared)
-
List modules that are available or modules that are present on your system but may or may not be enabled.
$ ls /etc/apache2/mods-available access_compat.load auth_basic.load ... authz_user.load rewrite.load
This directory contains all the available modules on a Debian-based system. The location may vary depending on the distribution.
-
List enabled modules using a2query.
$ a2query -m rewrite (enabled by site administrator) reqtimeout (enabled by maintainer script) env (enabled by maintainer script) deflate (enabled by maintainer script) negotiation (enabled by maintainer script) proxy_http (enabled by site administrator) authn_core (enabled by maintainer script) dir (enabled by maintainer script) authz_core (enabled by maintainer script) setenvif (enabled by maintainer script) autoindex (enabled by maintainer script) auth_basic (enabled by maintainer script) authz_host (enabled by maintainer script) alias (enabled by maintainer script) authz_user (enabled by maintainer script) access_compat (enabled by maintainer script) proxy (enabled by site administrator) filter (enabled by maintainer script) mpm_event (enabled by maintainer script) mime (enabled by maintainer script) authn_file (enabled by maintainer script)
-
List specific module using a2query.
$ a2query -m rewrite rewrite (enabled by site administrator)
-
List available and enabled modules in Ubuntu and similar systems.
$ ls /etc/apache2/mods-* /etc/apache2/mods-available: access_compat.load dir.conf proxy_express.load actions.conf dir.load proxy_fcgi.load actions.load dump_io.load proxy_fdpass.load alias.conf echo.load proxy_ftp.conf alias.load env.load proxy_ftp.load allowmethods.load expires.load proxy_hcheck.load asis.load ext_filter.load proxy_html.conf ##### snipped /etc/apache2/mods-enabled: access_compat.load authz_user.load filter.load proxy.conf alias.conf autoindex.conf heartbeat.load proxy_http.load alias.load autoindex.load mime.conf proxy.load auth_basic.load deflate.conf mime.load reqtimeout.conf authn_core.load deflate.load mpm_event.conf reqtimeout.load authn_file.load dir.conf mpm_event.load setenvif.conf authz_core.load dir.load negotiation.conf setenvif.load authz_host.load env.load negotiation.load
-
List available and enabled modules in CentOS and similar systems.
$ ls /etc/httpd/*modules*/ /etc/httpd/conf.modules.d/: 00-base.conf 00-dav.conf 00-mpm.conf 00-proxy.conf 01-cgi.conf 10-proxy_h2.conf 00-brotli.conf 00-lua.conf 00-optional.conf 00-systemd.conf 10-h2.conf README /etc/httpd/modules/: mod_access_compat.so mod_cgid.so mod_log_config.so mod_reflector.so mod_actions.so mod_cgi.so mod_log_debug.so mod_remoteip.so mod_alias.so mod_charset_lite.so mod_log_forensic.so mod_reqtimeout.so mod_allowmethods.so mod_data.so mod_logio.so mod_request.so mod_asis.so mod_dav_fs.so mod_lua.so mod_rewrite.so mod_auth_basic.so mod_dav_lock.so mod_macro.so mod_sed.so mod_auth_digest.so mod_dav.so mod_mime_magic.so mod_setenvif.so ##### snipped
Each of the configuration file might contain more than one LoadModule directives.