nginx basic auth wangxiuwen 2018-12-04 技术 tech, 技术 0 评论 字数统计: 43(字) 阅读时长: 1(分)123sudo yum install -y httpd-tools # centosapt install -y apache2-utils # ubuntuhtpasswd -c /usr/local/openresty/nginx/conf/htpasswd <username>nginx.conf123456server { ...... auth_basic "Private Property"; auth_basic_user_file /usr/local/openresty/nginx/conf/htpasswd; ......}重启 nginx1systemctl reload nginx