创建密码文件
htpasswd -c -d htpasswd -c -d /etc/nginx/conf.d/passwd username
在nginx配置文件中加上:
auth_basic "validate required";
auth_basic_user_file /etc/nginx/conf.d/passwd;
重启nginx服务即可
创建密码文件
htpasswd -c -d htpasswd -c -d /etc/nginx/conf.d/passwd username
在nginx配置文件中加上:
auth_basic "validate required";
auth_basic_user_file /etc/nginx/conf.d/passwd;
重启nginx服务即可