对2.html页面做授权操作

先进行账号密码的生成  使用  htpasswd -c /etc/nginx/auth_conf  用户名

输入2次密码

(如果没有htpasswd,可以使用yum  -y install httpd-tools 进行安装)

然后可使用  more  /etc/nginx/auth_conf 查看

接着配置

 location ~ ^/2.html {
        root   /opt/app/code;
        auth_basic    'bobobobobobo';
        auth_basic_user_file /etc/nginx/auth_conf;  //生成的账号密码位置
        index  index.html index.htm;
   }

效果图:

nginx学习http_auth_basic_module模块

 

按取消则会出现

nginx学习http_auth_basic_module模块

 

相关文章:

  • 2021-08-28
  • 2021-07-31
  • 2021-12-16
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2021-07-09
  • 2021-07-20
  • 2022-12-23
相关资源
相似解决方案