nginx为网站某个目录添加单独的认证
server {
listen 443 ssl;
server_namebook.com;
ssl_certificate cert.pem;
ssl_certificate_keycert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout5m;
ssl_ciphersHIGH:!aNULL:!MD5;
ssl_prefer_server_cipherson;
location / {
root C:\website\book;
indexindex.htm index.html index.php;
}
location /加密书籍 {
# 基本验证
root C:\website\book;
indexindex.htm index.html index.php;
auth_basic "nginx basic auth";
auth_basic_user_file C:\website\auth.txt;
}
}
密码文件生成网址
https://tool.oschina.net/htpasswd
选择方式md5
auth.txt认证文件格式
username:MD5password
页:
[1]