首页 > 其他 > 详细

nginx 配置用户认证

时间:2019-10-15 00:01:49      阅读:91      评论:0      收藏:0      [点我收藏+]
nginx 配置用户认证有两种方式:
1.auth_basic 本机认证,由ngx_http_auth_basic_module模块实现。
2.auth_request,由ngx_http_auth_request_module模块实现。

第一种方式:
yum -y install httpd-tools //安装 htpasswd 工具
htpasswd -c /etc/nginx/.passwd-www www //生成用户登录的认证文件
chmod 600 /etc/nginx/.passwd-www
配置nginx本地认证:
server {
    listen       80;
    server_name  www.imcati.com;
    
    auth_basic "User Authentication";
    auth_basic_user_file /etc/nginx/.passwd-www;
location / { root /usr/share/nginx/html; index index.html; } }
加载配置: nginx -s reload


 

nginx 配置用户认证

原文:https://www.cnblogs.com/imcati/p/11674682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!