- auth模块 默认已开启
- 生成账号
➜ ~ printf "ogenes:$(openssl passwd -crypt 888888)\n" >> account
➜ ~ cat account
ogenes:ddiY8Imto3UaA
- 配置
location / {
auth_basic "Please enter your username and password";
auth_basic_user_file account;
autoindex on;
……
}
- 重启
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ nginx -s reload
-
测试

