1,问题描述
nginx外网 + harbor nginx容器配置:
外网nginx代理后harbor域名:harbor01.io
harbor.cfg ( hostname = 192.168.56.72 ) ---> pull harbor01.io/xx/yy err
harbor.cfg ( hostname = harbor01.io ) ---> pull harbor01.io/xx/yy ok, push err
common/config/nginx/nginx.conf
修改配置/ , /v2/ , /service/
(proxy_set_header X-Forwarded-Proto https) ---> push harbor01.io/xx/yy ok, pull err
能pull镜像,但是push 镜像出现的问题:unauthorized: authentication required
[root@c7 wrapper-linux-x86-64-3.5.49]
The push refers to repository [harbor01.io/kuai/nginx]
d9eb91d66e2a: Pushing [==================================================>] 3.584kB
ae1f545e4c08: Pushing [=============> ] 512B/1.961kB
c20672db3628: Pushing [==================================================>] 3.072kB
4cbb728cd302: Preparing
9eb82f04c782: Preparing
unauthorized: authentication required
2,问题解决
参考:https://www.cnblogs.com/chenminklutz/p/13446164.html
- 把X-Forwarded-Proto设置为https,临时解决外网push镜像问题
- 把X-Forwarded-Proto还原,临时解决pull镜像问题
[root@c7 ~]
The push refers to repository [harbor01.io/kuai/nginx]
d9eb91d66e2a: Pushing [==================================================>] 3.584kB
ae1f545e4c08: Pushing [=============> ] 512B/1.961kB
c20672db3628: Pushing [==================================================>] 3.072kB
4cbb728cd302: Preparing
9eb82f04c782: Preparing
unauthorized: authentication required
[root@JXQ-11-243-32-211 harbor]
hostname = harbor01.io
[root@JXQ-11-243-32-211 harbor]
[root@JXQ-11-243-32-211 nginx]
total 32
drwx------ 2 65534 root 4096 Apr 18 15:57 client_body_temp
drwxr-xr-x 2 root root 4096 Apr 18 15:57 conf.d
drwx------ 2 65534 root 4096 Apr 18 15:57 fastcgi_temp
-rw-r----- 1 root root 3353 Apr 25 09:35 nginx.conf
-rw-r----- 1 root root 3654 Apr 22 15:21 nginx.conf.bak
drwx------ 2 65534 root 4096 Apr 18 15:57 proxy_temp
drwx------ 2 65534 root 4096 Apr 18 15:57 scgi_temp
drwx------ 2 65534 root 4096 Apr 18 15:57 uwsgi_temp
[root@JXQ-11-243-32-211 harbor]
[root@JXQ-11-243-32-211 harbor]
[root@JXQ-11-243-32-211 harbor]
[root@JXQ-11-243-32-211 harbor]
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Proto https;
[root@JXQ-11-243-32-211 harbor]
[root@JXQ-11-243-32-211 nginx]
[root@JXQ-11-243-32-211 nginx]
total 32
drwx------ 2 65534 root 4096 Apr 18 15:57 client_body_temp
drwxr-xr-x 2 root root 4096 Apr 18 15:57 conf.d
drwx------ 2 65534 root 4096 Apr 18 15:57 fastcgi_temp
lrwxrwxrwx 1 root root 14 Apr 25 10:14 nginx.conf -> nginx.conf.ori
-rw-r----- 1 root root 3647 Apr 25 10:14 nginx.conf.https
-rw-r----- 1 root root 3653 Apr 25 09:40 nginx.conf.ori
[root@JXQ-11-243-32-211 nginx]
|