今日排错---harbor无法登陆failed with status: 502 Bad Gateway

现象

[root@ln0-181 src]# docker login harbor.spos.lab
Authenticating with existing credentials...
Login did not succeed, error: Error response from daemon: login attempt to http://harbor.spos.lab/v2/ failed with status: 502 Bad Gateway
Username (admin): admin
Password: 
Error response from daemon: login attempt to http://harbor.spos.lab/v2/ failed with status: 502 Bad Gateway

排查

# 1. 直接请求harbor接口可以访问, 通过nginx代理不通
[root@ln0-181 conf.d]# curl -I http://harbor.spos.lab:180/harbor/sign-in
HTTP/1.1 200 OK
[root@ln0-181 conf.d]# curl -I http://harbor.spos.lab:80/harbor/sign-in
HTTP/1.1 502 Bad Gateway
# 2. nginx配置及启动没有问题
# 3. 查看nginx error日志
2021/05/13 09:54:17 [crit] 32484#0: *3 connect() to 127.0.0.1:180 failed (13: Permission denied) while connecting to upstream, client: 172.19.0.181, server: harbor.spos.lab, request: "HEAD /harbor/sign-in HTTP/1.1", upstream: "http://127.0.0.1:180/harbor/sign-in", host: "harbor.spos.lab"
# 4. 查看防火墙及selinux
[root@ln0-181 nginx]# getenforce 
Enforcing
[root@ln0-181 nginx]# setenforce 0
[root@ln0-181 nginx]# getenforce 
Permissive

验证

[root@ln0-181 nginx]# curl -I http://harbor.spos.lab/harbor/sign-in
HTTP/1.1 200 OK
posted @ 2021-05-13 10:07  骁珺在努力  阅读(6051)  评论(0编辑  收藏  举报