如何在 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 次檢視

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告

© . All rights reserved.