Httpd服务入门知识-Httpd服务常见配置案例之Apache的工作做状态status页面

          Httpd服务入门知识-Httpd服务常见配置案例之Apache的工作做状态status页面

                                                作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.status功能概述

status页面可以显示出Apache的工作状态,有助于咱们了解Apache服务是否工作正常

默认status模块是动态加载的哟:
  [root@node101.yinzhengjie.org.cn ~]# httpd -M | grep status_module
   status_module (shared)
  [root@node101.yinzhengjie.org.cn ~]# 

博主推荐阅读:
  http://httpd.apache.org/docs/2.4/mod/core.html#SetHandler

二.启用status功能

1>.修改httpd的配置文件

[root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep ServerRoot
ServerRoot "/etc/httpd"
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep IncludeOptional
IncludeOptional conf.d/*.conf
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat /etc/httpd/conf.d/status.conf 
<Location "/myweb">        #注意,客户端在浏览器访问的是"/myweb"关键词(该关键词咱们可以自定义哟~)就会调用下面我们定义的"server-status"功能模块的信息
    SetHandler server-status
</Location>
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# httpd -M | grep status_module
 status_module (shared)
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# httpd -t
Syntax OK
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# systemctl reload httpd
[root@node101.yinzhengjie.org.cn ~]# 

2>.测试web页面

  在浏览器输入:"http://node101.yinzhengjie.org.cn/myweb"就可以看到咱们的httpd服务器的工作状态,效果如下图所示。

三.显示扩展信息配置

1>.修改httpd的配置文件

[root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep ServerRoot
ServerRoot "/etc/httpd"
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf  | grep IncludeOptional
IncludeOptional conf.d/*.conf
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat /etc/httpd/conf.d/status.conf 
<Location "/myweb">
    SetHandler server-status
</Location>
ExtendedStatus On          #将其值设置为On就会看到更多详细信息
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# httpd -M | grep status_module
 status_module (shared)
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# httpd -t
Syntax OK
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# systemctl reload httpd
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 

2>. 测试试验效果

 

  经测试,发现官方文档是由错误的,因为我们修改ExtendedStatus的属性值是ON发现变化并不大。于是我们将ExtendedStatus的属性值是Off发现的确是有差异的哟~

  上图是ExtendedStatus的值为On

  下图是ExtendedStatus的值为Off

  从输出结果来看的确是将ExtendedStatus的值设置为On会看到更多的信息哟~

 

原文地址:https://www.cnblogs.com/yinzhengjie/p/12006761.html