查看apache 已加载模块


bsd# which httpd
/usr/local/sbin/httpd
bsd# httpd --help
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address [::]:443
[Tue Nov 09 09:31:22 2010] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
[Tue Nov 09 09:31:22 2010] [warn] (2)No such file or directory: Failed to enable the 'dataready' Accept Filter
bsd# httpd -M --已成功加载的模块
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
authn_default_module (shared)
authn_alias_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_dbm_module (shared)
authz_owner_module (shared)
authz_default_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
file_cache_module (shared)
cache_module (shared)
disk_cache_module (shared)
dumpio_module (shared)
reqtimeout_module (shared)
include_module (shared)
filter_module (shared)
charset_lite_module (shared)
deflate_module (shared)
log_config_module (shared)
logio_module (shared)
env_module (shared)
mime_magic_module (shared)
cern_meta_module (shared)
expires_module (shared)
headers_module (shared)
usertrack_module (shared)
unique_id_module (shared)
setenvif_module (shared)
version_module (shared)
ssl_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
asis_module (shared)
info_module (shared)
cgi_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
imagemap_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
php5_module (shared)
Syntax OK
bsd# httpd -l --已编译模块
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c


详细用法,参见 man httpd
<think> 我们正在回答用户关于如何检查Apache加载模块列表的问题 根据用户提供的引用和之前的问题,我们需要给出检查方法 同时,用户要求参考站内引用,但引用内容主要涉及安全性和PHP配置,与当前问题关联不大,因此以标准方法为主 检查Apache加载模块的常用方法有: 1. 使用apachectl或httpd命令列出模块 2. 查看Apache的配置文件(如httpd.conf)中LoadModule指令 3. 通过PHP的apache_get_modules函数(如果启用了PHP Apache模块) 由于用户明确要求检查已加载模块列表,我们将重点放在命令行方法和配置文件方法上 注意:不同系统下Apache的命令和配置文件路径可能不同,我们将给出通用方法和常见系统的示例 </think>### 如何检查 Apache加载模块列表 以下是检查 Apache加载模块的三种常用方法,按推荐顺序排列: #### 方法 1:使用 Apache 命令行工具(推荐) ```bash # 查看所有静态和动态加载模块(完整列表) apachectl -t -D DUMP_MODULES # 仅查看动态加载模块 apachectl -M ``` **示例输出**: ``` Loaded Modules: core_module (static) http_module (static) so_module (static) ... slotmem_shm_module (shared) watchdog_module (shared) heartmonitor_module (shared) ... ``` #### 方法 2:通过配置文件检查 检查 Apache 主配置文件(路径因系统而异): ```bash # 常见配置文件路径 /etc/apache2/apache2.conf # Debian/Ubuntu /etc/httpd/conf/httpd.conf # CentOS/RHEL # 搜索加载模块 grep LoadModule /etc/apache2/apache2.conf ``` **输出示例**: ```apache LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so LoadModule slotmem_shm_module /usr/lib/apache2/modules/mod_slotmem_shm.so ... ``` #### 方法 3:使用 PHP 检查(需启用 PHP 模块) 创建 `modules.php` 文件: ```php <?php print_r(apache_get_modules()); ?> ``` 访问该文件将输出: ```php Array ( [0] => core [1] => http_core [2] => so [3] => slotmem_shm ... ) ``` #### 注意事项: 1. **权限要求** - 命令行方法需要 `sudo` 权限或 `www-data` 用户权限 - 配置文件查看需要文件读取权限 2. **模块状态标识** - `(static)`:编译进 Apache 核心的模块 - `(shared)`:动态加载模块(可独立禁用) 3. **安全建议** 定期审查模块列表,禁用不需要的模块(如 `mod_heartmonitor` 等非必要模块)以降低攻击面[^1]。 > **提示**:结合 `apachectl -V` 可查看配置文件路径和编译参数。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值