Nginx Basic_module用户认证

Basic_module用户认证

安装支持htpasswd命令的软件

yum -y install httpd-tools

#生成htpasswd密码文件

htpasswd -bc /usr/local/nginx/html/pass.db admin 123

Basic模块使用:

auth_basic  "http://106.52.36.65";
auth_basic_user_file    /usr/local/nginx/html/pass.db;

使用:

 location /status {
          auth_basic  "http://106.52.36.65";
          auth_basic_user_file    /usr/local/nginx/html/pass.db;
          stub_status;
        }

结果页面:
在这里插入图片描述
autoindex自动列表:一般情况下不开启

autoindex on;

猜你喜欢

转载自blog.csdn.net/weixin_39218464/article/details/112715717