配置nginx身份验证(ngx_http_auth_basic_module)
2020-02-01 15:11
591 查看
编译的时候默认参数即可
./configure --with-pcre=../pcre --with-zlib=../zlib --with-http_ssl_module --with-openssl=../openssl --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_flv_module --with-debug
修改配置文件
location / {root /usr/local/nginx/html;
auth_basic "Auth";
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
index index.html index.htm;
}
auth_basic "Auth"中的Auth是弹出框(输入用户名和密码)的标题
auth_basic_user_file /usr/local/nginx/conf/htpasswd; 中的/usr/local/nginx/conf/htpasswd是保存密码的文件
密码文件生成,需要apt-get install mini-httpd
htpasswd -c /usr/local/nginx/conf/htpasswd 用户名
配置好后,重启,应该就可以了。
注:我在配置的时候,由于IE9缓存数据,造成不弹出身份验证框。清楚缓存就好了。
转载于:https://www.cnblogs.com/xewnwsl2001/archive/2010/12/14/1905648.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 配置nginx身份验证(ngx_http_auth_basic_module)
- 详细解释:nginx中ngx_http_auth_basic_module模块(HTTP Auth Basic 模块)配置及各个参数含义 .
- 详细解释:nginx中ngx_http_auth_basic_module模块(HTTP Auth Basic 模块)配置及各个参数含义 .
- nginx模块学习三 http_auth_basic_module 访问身份证验证
- 官网解读-nginx-ngx_http_auth_basic_module
- Nginx密码验证 ngx_http_auth_basic_module模块
- 详细解释:nginx中ngx_http_access_module模块(HTTP Access 模块)配置及各个参数含义
- nginx第三方模块(ngx_http_auth_pam_module)加注释
- Nginx Http认证 实现访问网站或目录密码认证保护 | 使用 HttpAuthBasicModule 模块
- 详细解释:nginx中ngx_http_access_module模块(HTTP Access 模块)配置及各个参数含义
- Nginx访问控制_登陆权限的控制(http_auth_basic_module)
- Nginx日志配置(Ngx_http_log_module)
- Nginx如果未开启SSL模块,配置Https时提示错误(the "ssl" parameter requires ngx_http_ssl_module)
- 在CentOS 6.9 x86_64的nginx 1.12.2上开启标准模块ngx_http_auth_request_module实录
- 解读nginx第三方模块ngx_http_auth_request_module
- Nginx 统计单虚拟机流量工具 - ngx_http_accounting_module
- nginx由ngx_http_gzip_module模块处理的9个指令
- 比ngx_http_substitutions_filter_module 更强大的替换模块sregex的replace-filter-nginx-module
- nginx图片过滤处理模块http_image_filter_module安装配置
- nginx图片过滤处理模块http_image_filter_module安装配置笔记