输入命令:htpasswd -c /***/.test user
然后根据提示输入密码就可以了
nginx配置
server {
listen 9999;
server_name localhost;
charset utf-8;
location / {
root /***/;
auth_basic "Login";
auth_basic_user_file /***/test;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}