用户认证
首先需要安装apache,可以使用yum install httpd 安装
生成密码文件,创建用户


LNMP_用户认证

LNMP_用户认证


htpasswd -c /usr/local/nginx/conf/htpasswd  test // 添加test用户,第一次添加时需要加-c参数,第二次添加时不需要-c参数
在nginx的配置文件中添加   vi /usr/local/nginx/conf/vhosts/jzq.conf
location  / {
                      root /data/www/uc_server;
                      auth_basic              "Auth";
                      auth_basic_user_file   /usr/local/nginx/conf/htpasswd;
            }


LNMP_用户认证


 /usr/local/nginx/sbin/nginx -t

 /usr/local/nginx/sbin/nginx -s reload

 

验证:

LNMP_用户认证




转载于:https://blog.51cto.com/68686789/1832154

相关文章:

  • 2021-07-26
  • 2021-07-20
  • 2021-10-12
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-11
  • 2022-02-05
  • 2022-01-19
  • 2021-12-31
相关资源
相似解决方案