如何在 Ubuntu 16.04 中检查启用了哪些 Apache 模块


Apache 是一个开源程序,免费提供。它运行在所有 Web 服务器的 67% 上。它快速、安全且易于使用。可以通过使用扩展和模块对其进行高度定制,以满足许多不同环境的需求。

要安装 apache,请使用以下命令:

$ sudo apt-get update
$ sudo apt-get install apache2

apache2ctl

apcahe2ctl 是 Apache 超文本传输协议 (HTTP) 服务器的前端。它旨在帮助管理员控制 Apache HTTP 守护程序的功能。要获取有关 apache2 模块的更多信息,请使用以下命令:

$ man apache2ctl
or
$ apache2ctl -h

示例输出应如下所示:

Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]
                         [-C "directive"] [-c "directive"]
                         [-k start|restart|graceful|graceful-stop|stop]
                         [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name                   : define a name for use in directives
-d directory              : specify an alternate initial ServerRoot
-f file                   : specify an alternate ServerConfigFile
-C "directive"            : process directive before reading config files
-c "directive"            : process directive after reading config files
-e level                  : show startup errors of level (see LogLevel)
-E file                   : log startup errors to file
-v                        : show version number
-V                        : show compile settings
-h                        : list available command line options (this page)
-l                        : list compiled in modules
-L                        : list available configuration directives
-t -D DUMP_VHOSTS         : show parsed vhost settings
-t -D DUMP_RUN_CFG        : show parsed run settings
-S                        : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES        : show all loaded modules
-M                        : a synonym for -t -D DUMP_MODULES
-t                        : run syntax check for config files
-T                        : start without DocumentRoot(s) check
-X                        : debug mode (only one worker, do not detach)

模块信息

要获取有关在 Ubuntu 16.04 中启用了哪些 Apache 模块的信息,请使用以下命令:

$ apache2ctl -M

示例输出应如下所示:

[Mon Jan 02 12:04:29.210625 2017] [so:warn] [pid 14538] AH01574: module dav_module is already loaded, skipping
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)
dav_module (shared)
dav_svn_module (shared)
authz_svn_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
include_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)

模块列表(按字母顺序排列)

如果要按字母顺序查看列表,请使用以下命令:

$ apachectl -M | sort

示例输出应如下所示:

[Mon Jan 02 12:08:33.025558 2017] [so:warn] [pid 14575] AH01574: module dav_module is already loaded, skipping
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_svn_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
cgi_module (shared)
core_module (static)
dav_module (shared)
dav_svn_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
http_module (static)
include_module (shared)
Loaded Modules:
log_config_module (static)
logio_module (static)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
rewrite_module (shared)
setenvif_module (shared)
so_module (static)
status_module (shared)
unixd_module (static)
version_module (static)
watchdog_module (static)

模块信息

另一种获取已启用/加载的 Apache 模块列表的简单方法如下所示:

$ apachectl -t -D DUMP_MODULES

示例输出应如下所示:

[Mon Jan 02 12:12:18.015390 2017] [so:warn] [pid 14641] AH01574: module dav_module is already loaded, skipping
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)
dav_module (shared)
dav_svn_module (shared)
authz_svn_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
include_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)

模块列表(按字母顺序排列)

如果要按字母顺序查看列表,请使用以下命令:

$ apachectl -t -D DUMP_MODULES | sort

示例输出应如下所示:

[Mon Jan 02 12:13:59.845909 2017] [so:warn] [pid 14657] AH01574: module dav_module is already loaded, skipping
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_svn_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
cgi_module (shared)
core_module (static)
dav_module (shared)
dav_svn_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
http_module (static)
include_module (shared)
Loaded Modules:
log_config_module (static)
logio_module (static)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
rewrite_module (shared)
setenvif_module (shared)
so_module (static)
status_module (shared)
unixd_module (static)
version_module (static)
watchdog_module (static)

在本文中,我们学习了:了解如何在 Ubuntu 16.04 中检查启用了哪些 Apache 模块。在我们的下一篇文章中,我们将推出更多基于 Linux 的技巧和提示。继续关注!

更新于: 2024-02-29

286 次查看

开启你的 职业生涯

通过完成课程获得认证

开始
广告