课程评价 (0)

请对课程作出评价:
0/300

学员评价

暂无精选评价
1分钟

实现基于用户的访问控制

ngx_http_auth_basic_module**模块**

实现基于用户的访问控制,使用basic**机制进行用户认证**

1、auth_basic string | off;

2、auth_basic_user_file file;

location /admin/ {

auth_basic “Admin Area”;

auth_basic_user_file /etc/nginx/.ngxpasswd;

}

用户口令文件:

1、明文文本:格式name:password:comment

2、加密文本:由htpasswd命令实现

httpd-tools**所提供**

示例:

cd /etc/nginx/conf.d/vhost

htpasswd -cm nginxuser httpuser1

htpasswd -m nginxuser httpuser2

修改配置

针对整个网站生效

针对特定目录生效

http://www.a.com/admin/