Nginx Basic_module user authentication

Basic_module user authentication

Install software that supports the htpasswd command

yum -y install httpd-tools

#Generate htpasswd password file

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

Basic module use:

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

use:

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

Result page:
Insert picture description here
autoindex automatic list: generally do not open

autoindex on;

Guess you like

Origin blog.csdn.net/weixin_39218464/article/details/112715717