136

Is there a command that list all enabled Apache modules?

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
supercobra
  • 1,515
  • 2
  • 12
  • 9

7 Answers7

207

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.

Valentin Bajrami
  • 4,045
  • 1
  • 18
  • 26
  • 3
    `-M` will also work. – Andrew B Feb 04 '13 at 12:07
  • 30
    I love this comment about google search (found this answer via google) – Pawelmhm Sep 25 '13 at 19:41
  • 1
    The use of server-info is harder to find via google and gives much more details && the ability to give access to the information to people who don't have shell access (eg client, web developpers, project managers, ...) –  Nov 06 '13 at 12:44
  • `man apachectl` on Ubuntu 20.04 does not include this option (or others), but the command still works. The man page isn't that helpful here – Amandasaurus Nov 18 '20 at 12:15
  • Prefix command with sudo e.g. `sudo httpd -M` if you get errors like local ssl cert not found etc. Its due to permission issue. – Mihir Kagrana Jun 29 '22 at 14:17
11

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,193
  • 1
  • 25
  • 40
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.

rickfoosusa
  • 231
  • 4
  • 5
  • 1
    Why not use the ````a2enmod```` command to enable an {installed} module, instead of "symlinking" it manually? – Flo Schild Jun 08 '15 at 08:37
  • Yes a2enmod is more correct. When I'm editing configs I usually stay with the files and don't think of the specialty commands that I rarely use. – rickfoosusa Jun 09 '15 at 14:02
  • Okay, it works both ways anyway, in 2.4 (maybe already earlier also?) you also have the ````a2enconf```` to symlink files from "conf-available" directory to "conf-enabled" :) – Flo Schild Jun 09 '15 at 14:19
7

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
  • 175
  • 1
  • 6
4

This works also:

apache2ctl -M
simhumileco
  • 155
  • 1
  • 8
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,206
  • 12
  • 29
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
  • 461
  • 1
  • 8
  • 20