如何列出 Apache 启用的模块?

sup*_*bra 118 linux http web-server apache-2.2

是否有列出所有启用的 Apache 模块的命令?

Val*_*ami 175

要列出 apache 加载的模块,请使用:

apachectl -M
Run Code Online (Sandbox Code Playgroud)

或者:

apachectl -t -D DUMP_MODULES 
Run Code Online (Sandbox Code Playgroud)

或在 RHEL、CentoS、Fedora 上:

httpd -M
Run Code Online (Sandbox Code Playgroud)

更多选择man apachectl。所有这些答案都可以通过一点点谷歌搜索找到。

  • 我喜欢这个关于谷歌搜索的评论(通过谷歌找到这个答案) (27认同)
  • `-M` 也可以工作。 (3认同)

ALe*_*hha 10

您也可以使用server- info 从远程服务器获取信息

<Location /server-info>
   SetHandler server-info
   Order allow,deny
   Allow from 127.0.0.1 xxx.xxx.xxx.xxx
</Location>
Run Code Online (Sandbox Code Playgroud)

您可以在http://your.host.example.com/server-info?list获取所有启用的 Apache 模块的列表


ric*_*usa 8

您需要启用信息模块:

sudo a2enmod info.load
sudo a2enmod info.conf
sudo service apache2 restart
Run Code Online (Sandbox Code Playgroud)

重启后:

http://localhost/server-info
Run Code Online (Sandbox Code Playgroud)

将提供一长串模块和配置信息。

要从远程服务器查看,您可以更改 /etc/apache2/mods-available/info.conf 中的“需要”选项以允许远程服务器查看信息。


kjo*_*nes 8

在 Debian 和 Ubuntu 的最新版本中,还有以下a2query命令:

a2query -m
authz_host (enabled by maintainer script)
ssl (enabled by site administrator)
...
Run Code Online (Sandbox Code Playgroud)

用法:

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
Run Code Online (Sandbox Code Playgroud)

  • `a2query -m` 是一个宝石!谢谢! (2认同)