Nginx中ngx_http_auth_basic_moudel和ngx_http_stub_status_module模块

ngx_http_auth_basic_module
实现基于⽤用户的访问控制,使⽤用basic机制进⾏行行⽤用户认证
指令:
5.1 auth_basic
Syntax: auth_basic string | off;
Default: auth_basic off;
Context: http, server, location,
limit_except
5.2 auth_basic_user_file
Syntax: auth_basic_user_file file;
Default: —
Context: http, server, location,
limit_except
location /images/ {
root /app/web/;
auth_basic "Admin Area";
auth_basic_user_file /etc/ng
inx/.ngxpasswd;
}
5.2.1 ⽤用户⼝口令⽂文件
1、明⽂文⽂文本:格
式 name:password:comment
2、加密⽂文本:由 htpasswd 命令实现,安装
包是 httpd-tools
htpasswd -cm /etc/nginx/.ngxpasswd a
dmin
六、ngx_http_stub_status_modul
e
⽤用于输出nginx的基本状态信息
Syntax: stub_status;
Default: —
Context: server, location
location /status/ {
stub_status;
}
提供⼀一下状态信息
Active connections # 当前状态,活动状
态的连接数
accepts # 统计总值,已经接受的客户端请
求的总数
handled # 统计总值,已经处理理完成的客户
端请求的总数
requests # 统计总值,客户端发来的总的请
求数
Reading # 当前状态,正在读取客户端请求
报⽂文⾸首部的连接的连接数
Writing # 当前状态,正在向客户端发送响
应报⽂文过程中的连接数
Waiting # 当前状态,正在等待客户端发出
请求的空闲连接数

posted @ 2019-06-14 18:29  莫孟林  阅读(227)  评论(0编辑  收藏  举报