#设定查看Nginx状态的地址,添加如下
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file conf/htpasswd;
}
其中密码文件中每条用户名和密码的格式为: user:password
该密码文件不能由用户直接指定,需要通过apache的btpasswd生成密码
生成密码的指令为:
/usr/local/apache2/htpasswd -bc /export/servers/nginx/conf/htpasswd usr1 passwd1
输入地址 http://10.0.0.1/NginxStatus/,输入验证帐号密码,即可
==============================================
无密码,限访问IP
location /nginx_status {
stub_status on;
access_log off;
allow SOME.IP.ADD.RESS; #例:allow 10.0.0.1/24
deny all;
}