Nginx 如何配置 Basic Auth 认证
1, 使用 htpasswd 生成 passfile 文件
yum install -y httpd-tools # 安装 htpasswd -c -d /etc/nginx/pass_file username
2,添加到 nginx 配置
location /test { auth_basic "登录认证"; auth_basic_user_file /data/conf.d/pass_file; autoindex on; autoindex_exact_size on; autoindex_localtime on; }