access模块
限制某些ip的访问
1 2 3 4 5 6
| Syntax: allow address | CIDR | unix: | all; Default: — Context: http, server, location, limit_except Syntax: deny address | CIDR | unix: | all; Default: — Context: http, server, location, limit_except
|
auth_basic模块
用来做用户名密码认证
指令:
1 2 3 4 5 6 7 8 9 10 11
| Syntax: auth_basic string | off; Default: auth_basic off; Context: http, server, location, limit_except
##这个string就是在网站上显示的字符串
Syntax: auth_basic_user_file file; Default: — Context: http, server, location, limit_except ##这个file文件可以用htpasswd来简单生成htpasswd –c file –b user pass , 或者直接写文件 , 文件格式为: name1:password1 , 一行一个
|
auth_request模块
1 2 3 4 5 6
| Syntax: auth_request uri | off; Default: auth_request off; Context: http, server, location Syntax: auth_request_set $variable value; Default: — Context: http, server, location
|
收到请求后, 生成子请求 , 把子请求传递给上游 , 上游 返回200 , 则转发这个请求 , 若是上游返回401或者403 , 则将响应返回 给客户端