153

Is there a command that list all enabled Apache modules?

HopelessN00b
  • 54,273
supercobra
  • 1,685

8 Answers8

233

To list apache loaded modules use:

apachectl -M

or:

apachectl -t -D DUMP_MODULES 

or on RHEL,CentoS, Fedora:

httpd -M

For more options man apachectl. All these answers can be found just by little google search.

12

Also you can use server-info to get info from remote servers

<Location /server-info>
   SetHandler server-info
   Order allow,deny
   Allow from 127.0.0.1 xxx.xxx.xxx.xxx
</Location>

You can get list of all enabled Apache modules at http://your.host.example.com/server-info?list

ALex_hha
  • 7,415
11

On more recent iterations of Debian and Ubuntu there is also the a2query command:

a2query -m
authz_host (enabled by maintainer script)
ssl (enabled by site administrator)
...

Usage:

Usage: /usr/sbin/a2query -q -m [MODULE] -s [SITE] -c [CONF] -a -v -M -d -h
-q              suppress any output. Useful for invocation from scripts
-m [MODULE]     checks whether the module MODULE is enabled, lists all enabled
modules if no argument was given
-s [SITE]       checks whether the site SITE is enabled, lists all sites if no
argument was given
-c [CONF]       checks whether the configuration CONF is enabled, lists all
configurations if no argument was given
-a              returns the current Apache 2 module magic version
-v              returns the current Apache 2 version
-M              returns the enabled Apache 2 MPM
-d              returns the Apache 2 module directory
-h              display this help
kjones
  • 214
8

You need to enable the info module:

sudo a2enmod info.load
sudo a2enmod info.conf
sudo service apache2 restart

After restart:

http://localhost/server-info

will provide a long list of modules, and configuration info.

To view from remote servers, you can change the 'Requires' option in /etc/apache2/mods-available/info.conf to allow remote servers to view info.

4

This works also:

apache2ctl -M
1

The above answers are old and no longer work for my modern Fedora Server 31 / 32 and Apache 2.4.

Here's what does:

httpd -t -D DUMP_MODULES

But, there is a caveat that this will only work if you have an appropriately configured /etc/httpd/conf/httpd.conf, so if you're in the middle of editing to set LogLevel, it won't work if your edits are in-progress and not valid!

Richard T
  • 1,332
0

Ubuntu 22.04 LTS:

sudo a2enmod info.load
sudo service apache2 restart

After restart:

sudo wget http://localhost/server-info --no-check-certificate && cat server-info
Black
  • 501
-1

For security and hardening purposes, here's the list of modules that are found on a Wordpress site by default: It may be useful to paste these into a text file (with gedit, nano, or vim) and diff it against the result of apachectl -t -D DUMP_MODULES Remember to use vim VISUAL to highlight your file and < to remove any indentation.

Loaded modules:

  • core_module (static)
  • so_module (static)
  • watchdog_module (static)
  • http_module (static)
  • log_config_module (static)
  • logio_module (static)
  • version_module (static)
  • unixd_module (static)
  • access_compat_module (shared)
  • alias_module (shared)
  • auth_basic_module (shared)
  • authn_core_module (shared)
  • authn_file_module (shared)
  • authz_core_module (shared)
  • authz_host_module (shared)
  • authz_user_module (shared)
  • autoindex_module (shared)
  • deflate_module (shared)
  • dir_module (shared)
  • env_module (shared)
  • filter_module (shared)
  • mime_module (shared)
  • mpm_prefork_module (shared)
  • negotiation_module (shared)
  • php_module (shared)
  • reqtimeout_module (shared)
  • rewrite_module (shared)
  • setenvif_module (shared)
  • status_module (shared)
skyber
  • 1