用户认证模块(auth_basic)
# 加密设置
location /img {
auth_basic "User Auth"; #设置名字
auth_basic_user_file /usr/local/nginx/conf/auth.passwd; #用户认证文件放置路径
}
# 生成认证文件
[root@localhost html]# yum install httpd-tools -y
[root@localhost html]# htpasswd -c /usr/local/nginx/conf/auth.passwd admin
New password:
Re-type new password:
Adding password for user admin