status模块可以查看apache的运行状态,因此一般不给普通用户查看,以下实验会设置一个账户,只有输入账号正确才能查看status模块。
开启status模块:
LoadModule status_module modules/mod_status.so
在虚拟主机端添加以下内容1
2
3
4
5
6
7
8
9
10
11
12##/my-status为虚拟目录。可以随意指定
<Location /my-status>
SetHandler server-status
AuthType Basic
AuthName "Restricted Files"
##认证方式,通过文件认证
AuthBasicProvider file
##认证文件的存放位置
AuthUserFile "/etc/httpd/passwd"
##账户认证功能
Require valid-user
</Location>
设置账户信息(用户名为li,执行这条命令后会让连续输入两次密码):
[root@DMZ-httpd /usr/local/apache24/conf]# /usr/local/apache24/bin/htpasswd -c /etc/httpd/htpasswd li
查看账户信息是否存在:
[root@DMZ-httpd /usr/local/apache24/conf]# cat /etc/httpd/htpasswd
li:$apr1$DlLFfWJI$uehANNAJtbPHtXX4W6bZ01
重启服务后从浏览器查看验证:
[root@DMZ-httpd /usr/local/apache24]# /usr/local/apache24/bin/apachectl graceful
输入账号信息后:
最后更新: 2019年09月01日 19:23
原始链接: https://LiYuanSh.github.io/2019/08/31/Apache-status状态查询模块/