nginx认证怎么实现

安装httpd

yum install

使用htpasswd生产密码文件

htpasswd -c /usr/local/nginx/conf/htpasswd aming # -c 表示创建文件, aming是用户名 # 当添加用户时,需要去掉 -c 参数 # 修改密码的方式和添加用户的方式相同

配置nginx用户认证

location  /admin/   {       auth_basic              "Auth";       auth_basic_user_file   /usr/local/nginx/conf/htpasswd;   }

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享