Default:auth_basic off; Context:http,server,location,limit_except``` Syntax:`auth_basic_user_file file;` Default:`-` Context:`http,server,location,limit_except`
首先生成密码文件
htpasswd -c ./auth_conf username
location ~ ^/admin.html{
root /www/html;
auth_basic "Auth access test,Input you password";
auth_basic_user_file /etc/auth_conf;
index index.html index.htm;
}
局限性
解决方案
- Nginx结合LUA实现高效验证
- Nginx和LDAP打通,利用
nginx-auth-ldap
模块