https://cuiqingcai.com/5445.html


 

 

安装 nginx

 

找到配置文件

find / -name nginx.conf

修改

http {
    server {
        listen 6801;
        location / {
            proxy_pass    http://127.0.0.1:6800/;
            auth_basic    "Restricted";
            auth_basic_user_file    /etc/nginx/conf.d/.htpasswd;
        }
    }
}

 

安装 htpasswd 

https://www.jianshu.com/p/f4120aa561cc

yum -y  install httpd

生成密码

在/etc/nginx/conf.d目录下 

htpasswd -c .htpasswd admin

启动 nginx

 

 


控制项目

headers={
    'Authorization': 'Basic 填写你自己的'
}