出现了The HTTP server did not provide the username in the Authorization header when it forwarded the request to Gerrit Code Review. 这个错误的时候。
location / {
auth_basic "Gerrit Code Review";
#这里漏了
auth_basic_user_file /passwords;
proxy_pass http://127.0.0.1:8888;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
增加一句就好
auth_basic_user_file /passwords;
gerrit创建用户
htpasswd -c /passwords admin 创建文件,并新增一个用户
htpasswd -m /passwords admin 新增一个用户