1、auth_basic
Syntax: auth_basic string | off; Default: auth_basic off; Context: http, server, location, limit_except
2、auth_basic_user_file
Syntax: auth_basic_user_file file; Default: — Context: http, server, location, limit_except
举例:
auth_basic "who am i"; auth_basic_user_file passwd.db;
使用htpassword生成密码.
htpasswd -c /usr/local/nginx/passwd.db taisha htpasswd /usr/local/nginx/passwd.db guohu
相关文章:
Pingback引用通告: Nginx Location配置总结 | 精彩每一天
Pingback引用通告: Nginx中变量详解 | 精彩每一天