返回顶部

nginx 访问控制之 认证

安装httpd

yum install -y httpd

使用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;
  }

 

posted @ 2019-05-09 11:25  御用闲人  阅读(292)  评论(0编辑  收藏  举报