未findapache服务器状态。 检查是否启用了mod_status

我在munin节点上启用了apache_插件:
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] 

但是mod_status已经启用了:

 $ a2enmod status Module status already enabled 

重启apache并没有什么区别。

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

 $ 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 

有谁知道为什么我仍然得到server-status not found消息,我怎么能摆脱它?

更新回答1

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

我可以通过查看/var/log/apache2/access.log来validationmunin是否有效地提出了相应的请求:

 127.0.0.1 - - [10/Nov/2011:07:24:15 +0000] "GET /server-status?auto HTTP/1.1" 404 7774 "-" "libwww-perl/5.834 

在我的情况下,设置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] 

请注意,这并不代表安全问题,因为在apache站点中访问/server-status被限制为127.0.0.1

更新了答案2

因为这已经在/etc/apache2/mods-enabled/status.conf定义了,所以看起来并不需要将Location添加到apache站点。 顺便说一句,如果你想添加ExtendedStatus On指令,那是在你应该这样做的文件。

看起来好像是试图向状态模块发出请求。 你有一个适当的configuration你的VirtualHost的状态位置? 像这样的东西:

 <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> 

我发现我可以跑

 $ wget http://localhost/server-status?auto 

但不是

 $ wget http://127.0.0.1/server-status?auto 

第一个是打到默认服务器,第二个是虚拟服务器。

所以我明确地添加了一个Apache部分到/etc/munin/plugin-conf.d/munin-node

 [apache_*] env.url http://localhost:%d/server-status?auto env.ports 80 

并得到了我的munin apache图表。

我在这个网站上find了许多Ayromlou的解决scheme:

问题是,这些在WordPress的.htaccess规则接pipe服务器信息和服务器状态url在Apache的configuration中激活,并返回一个页面未find错误。 我遇到了很多网站,build议添加一个规则,如:

  RewriteCond %{REQUEST_URI} !=/server-status 

这不适合我。 我不确定是否多点版本的WordPress(我正在使用)造成这种情况。 美丽的规则是:

  RewriteRule ^(server-info|server-status) - [L] 

当服务器信息或服务器状态被parsing为URL的一部分时,此规则停止重写引擎。

内置于Apache Web服务器中的mod_status从Web浏览器获取服务器状态。 通过这个模块,我们可以很容易地发现服务器的性能如何。 所有报告都以html格式生成。

步骤1。 检查状态模块是否启用apache2ctl -M或ls / etc / apache2 / sites-enabled

第2步。 如果未启用,则通过该命令启用它,

sudo a2enmod状态

第3步。 configuration访问,

打开/etc/apache2/mods-enabled/status.conf并注释行,

  #<Location /server-status> # SetHandler server-status # Require local #Require ip 192.0.2.0/24 #</Location> 

并添加以下行,

  <Location /server-status> SetHandler server-status Order deny,allow Allow from all </Location> 

我们可以通过编辑来限制这个configuration中特定IP的服务器状态的访问,允许从our_public_ipaddress而不是全部允许

保存status.conf文件。

步骤4。 重新启动apache的命令,

/etc/init.d/apache2重新启动

第五步。 在浏览器中检查服务器状态页面

HTTP://服务器IP /服务器状态

希望这会有所帮助。

我遇到了同样的问题。 这里有一些更多的诊断步骤。 试着做

 munin-run apache_processes autoconf 

这是一个更直接的方式来看到相同的错误“ 不(没有Apache 80端口上的服务器状态)

现在尝试做

 wget http://127.0.0.1/server-status?auto 

对我来说这是给予禁止403

我也在我的主要apache错误日志中看到“客户端被服务器configuration拒绝:/ var / www / server-status”

你也一样?

对于我来说,Shane Madden的答案实际上解决了这个问题。

如果仅从127.0.0.1禁用/ server-status,则可以为127.0.0.1创build具有以下内容的VirtualHostconfiguration:

 <VirtualHost *:80> ServerAdmin [email protected] ServerName 127.0.0.1 DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www> Options +FollowSymLinks AllowOverride None order allow,deny allow from all </Directory> </VirtualHost> 

这里是更详细的解释