找不到 apache 服务器状态。检查 mod_status 是否启用

Max*_*Max 9 mod-rewrite munin ubuntu-10.04 apache-2.2

apache_在 munin 节点上启用了插件:
ln -sv /usr/share/munin/plugins/apache_* /etc/munin/plugins/

service munin-node restart这里重新启动节点后,我得到了错误:

$ munin-node-configure --suggest 2>/dev/null | grep "apache\|Plugin\|------"
Plugin                     | Used | Suggestions                            
------                     | ---- | -----------                            
apache_accesses            | yes  | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | yes  | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | yes  | no [apache server-status not found. check if mod_status is enabled]
Run Code Online (Sandbox Code Playgroud)

但是mod_status已经启用:

$ a2enmod status
Module status already enabled
Run Code Online (Sandbox Code Playgroud)

重新启动 apache 并没有什么区别。

如果我尝试手动运行插件,这就是我得到的(我读到获得 U 是个坏消息,所以至少这是一致的)。

$ munin-run apache_accesses --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_accesses'
accesses80.value U

$ munin-run apache_processes --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_processes'
busy80.value U
idle80.value U
free80.value U

$ munin-run apache_volume --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_volume'
volume80.value U
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么我仍然收到server-status not found消息以及如何摆脱它?

更新答案 1

Shane 关于在 apache 站点中使用Location和设置请求处理程序的建议是正确的SetHandler。有关更多信息,mod_status请参阅此页面

我可以munin通过查看/var/log/apache2/access.log我在哪里得到这个来验证它是否有效地提出了适当的请求:

127.0.0.1 - - [10/Nov/2011:07:24:15 +0000] "GET /server-status?auto HTTP/1.1" 404 7774 "-" "libwww-perl/5.834
Run Code Online (Sandbox Code Playgroud)

在我的情况下,设置Location还不够,因为我正在运行一个Drupal站点,并且.htaccess结合了mod_rewrite重写请求。要修复它,我必须将以下行添加到我的.htaccess

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteCond %{REQUEST_URI} !=/server-status  # <= added this line
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

请注意,这并不代表安全问题,因为访问/server-status仅限127.0.0.1于 apache 站点。

更新了答案 2

似乎Location根本不需要将 添加到 apache 站点,因为这已经在/etc/apache2/mods-enabled/status.conf. 顺便说一句,如果你想添加ExtendedStatus On指令,那在你应该做的那个文件中。

Sha*_*den 5

似乎它正在尝试实际向状态模块发出请求。你的状态位置有正确的配置VirtualHost吗?像这样的东西:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>
Run Code Online (Sandbox Code Playgroud)


小智 5

我在这个网站上找到了 Many Ayromlou 的解决方案:

\n
\n

问题是,wordpress 中的这些 .htaccess 规则接管了在 apache\xe2\x80\x99s 配置中激活的服务器信息和服务器状态 URL,并返回页面未找到错误。\n我遇到了许多网站,建议添加类似规则:

\n
    RewriteCond %{REQUEST_URI} !=/server-status\n
Run Code Online (Sandbox Code Playgroud)\n

这对我不起作用。我不确定 WordPress 的多站点版本(我正在使用)是否导致了这种情况。效果很好的规则如下:

\n
    RewriteRule ^(server-info|server-status) - [L]\n
Run Code Online (Sandbox Code Playgroud)\n

每当 server-info 或 server-status 被解析为 URL 的一部分时,此规则就会停止重写引擎。

\n
\n