Nginx 网页加密访问功能
功能图片
开始操作
- 安装 htpassword 工具
yum install -y httpd-tools
- 修改 Nginx 配置
在server
或者location
下新增
auth_basic "Please input your password";
auth_basic_user_file /data/nginx/conf/passwd.db;
- 设置用户以及密码
htpassword -c /data/nginx/conf/passwd.db chenxiansheng
123123
123123
- 重载 Nginx
./nginx -s reload
- 其它命令
5.1 利用htpassword
命令添加用户# 添加新用户为:chenxiansheng,密码为:123123