Skip to content

Nginx 配置账号密码

安装HTTPD Tools工具包

shell
yum -y install httpd-tools

生成密码文件

shell
htpasswd -bdc FileName user password

nginx添加密码配置

nginx
auth_basic "Restricted";
auth_basic_user_file /xxx/xxx/xxx;

!> 重启Nginx