Nginx基于用户名和密码访问的auth_basic模块


基于HTTP Basic Authentication协议进行用户名密码认证
默认已经编译进Nginx

安装htpasswd,如果没有,则手动安装
yum install -y httpd-tools

生成用户命名密码文件
在nginx目录下建立auth目录,进入目录,新建两个用户
htpasswd -b -c encrypt_pass jack 111111
htpasswd -b  encrypt_pass rose 111111

vim nginx

location / {
            root   html;
            index  index.html index.htm;

            auth_basic "测试basic功能";
            auth_basic_user_file /usr/local/nginx/auth/encrypt_pass;
        }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM