1 安装httpd模块 yum install httpd-tools -y 2 创建用户名和密码 htpasswd -bc /etc/nginx/conf/htpasswd macy 123456 3 Nginx的配置 server { listen 80; server_name xx.xx.com; location / { proxy_pass http://172.17.108.67:8500; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf/htpasswd; } }