问题:
如何使用Apache2 web服务器列出所有当前启用的模块?
回答:
结合使用apache2ctl
命令和M
选项可以列出系统上所有已加载的apache模块。例如,以下linux命令将在单独的行中列出所有加载的模块:
# apache2ctl -M 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)
上述命令的另一种替代方法是:
# apache2ctl -t -D DUMP_MODULES
另一个,但不太可靠的方法是列出/etc/apache2/mods-enabled/
中的模块
# ls /etc/apache2/mods-enabled/ access_compat.load auth_basic.load authz_core.load autoindex.conf deflate.load env.load geoip.load mpm_event.conf negotiation.load setenvif.load alias.conf authn_core.load authz_host.load autoindex.load dir.conf filter.load mime.conf mpm_event.load rewrite.load status.conf alias.load authn_file.load authz_user.load deflate.conf dir.load geoip.conf mime.load negotiation.conf setenvif.conf status.load
上面列出的所有模块都已启用,但可能尚未加载,因为它们仅表示到位于“/etc/apache2/mods available/”中对应模块的符号链接。
例如:
# ls -l /etc/apache2/mods-enabled/rewrite.load lrwxrwxrwx. 1 root root 30 Jun 23 02:32 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load
如果您正在搜索特定加载的模块,只需将STDOUT从'apache2ctl'命令重定向到'grep'命令。例如,让我们搜索“rewrite”和“alias”模块当前是否已加载:
# apache2ctl -M | grep -E "rewrite|alias" alias_module (shared) rewrite_module (shared)
日期:2020-07-07 20:54:41 来源:oir作者:oir