请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

master 节点安装 nginx(1.14.1) 配置后打不开 harbor

控制台输出

[root@rep-vware-harbor70 nginx]# vi nginx.conf
[root@rep-vware-harbor70 nginx]# sh nginx_restart.sh
harbornginx
harbornginx
2d863f573d90d3d82849df6bfc30908bb09ac034e3d57f16e2d1e6869a26a9df
[root@rep-vware-harbor70 nginx]# ps -ef | grep nginx
root       38767   38747  0 09:14 pts/0    00:00:00 nginx: master process nginx -g daemon off;
101        38782   38767  0 09:14 pts/0    00:00:00 nginx: worker process
root       38784   37676  0 09:14 pts/0    00:00:00 grep --color=auto nginx
[root@rep-vware-harbor70 nginx]# ping 172.16.11.71
PING 172.16.11.71 (172.16.11.71) 56(84) bytes of data.
64 bytes from 172.16.11.71: icmp_seq=1 ttl=64 time=13.0 ms
64 bytes from 172.16.11.71: icmp_seq=2 ttl=64 time=0.314 ms
64 bytes from 172.16.11.71: icmp_seq=3 ttl=64 time=0.238 ms
^C
--- 172.16.11.71 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2058ms
rtt min/avg/max/mdev = 0.238/4.527/13.030/6.012 ms
[root@rep-vware-harbor70 nginx]# ping 172.16.11.72
PING 172.16.11.72 (172.16.11.72) 56(84) bytes of data.
64 bytes from 172.16.11.72: icmp_seq=1 ttl=64 time=9.37 ms
64 bytes from 172.16.11.72: icmp_seq=2 ttl=64 time=0.327 ms
^C
--- 172.16.11.72 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.327/4.846/9.365/4.519 ms
[root@rep-vware-harbor70 nginx]# vi nginx_restart.sh
[root@rep-vware-harbor70 nginx]# cat nginx_restart.sh
#!/bin/bash

#停掉容器
docker stop harbornginx

#删除容器
docker rm harbornginx

#启动容器(-v 挂着目录)
docker run -idt --net=host --name  harbornginx -v /root/nginx/nginx.conf:/ect/nginx/nginx.conf nginx:1.14.1

[root@rep-vware-harbor70 nginx]# vi /root/nginx/nginx.conf
[root@rep-vware-harbor70 nginx]# docker logs cabe51ca9ede681c1
Error: No such container: cabe51ca9ede681c1
[root@rep-vware-harbor70 nginx]# docker container ls
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS     NAMES
2d863f573d90   nginx:1.14.1   "nginx -g 'daemon of…"   4 minutes ago   Up 4 minutes             harbornginx
[root@rep-vware-harbor70 nginx]# docker logs 2d863
[root@rep-vware-harbor70 nginx]# vi nginx.conf
[root@rep-vware-harbor70 nginx]# sh nginx_restart.sh
harbornginx
harbornginx
bf106f5785b414ed497b6c1111c0a34990ee90cf256e736197be62b05debd8b2
[root@rep-vware-harbor70 nginx]# docker container ls
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS     NAMES
bf106f5785b4   nginx:1.14.1   "nginx -g 'daemon of…"   59 seconds ago   Up 58 seconds             harbornginx
[root@rep-vware-harbor70 nginx]# docker logs bf1
[root@rep-vware-harbor70 nginx]#

图片描述
80端口OK

[root@rep-vware-harbor70 nginx]# netstat -tnlup|grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      38872/nginx: master

71,72 worker 节点能打开 harbor
图片描述
图片描述
70 访问不了
图片描述
图片描述
nginx.conf 配置

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;

pid /var/run/nginx.pid;

events {

   worker_connections 1024;
}

stream {

    upstream hub {
           server 172.16.11.71:80;
    }
    server {
         listen 80;
         proxy_pass hub;
         proxy_timeout 300s;
         proxy_connect_timeout 5s;
    }
}

请问这个我需要怎么处理??

正在回答 回答被采纳积分+3

2回答

刘果国 2021-08-14 09:13:05

哦,harbor要配置成域名

0 回复 有任何疑惑可以回复我~
  • 提问者 惜福7840346 #1
    配置了,还是不行
    回复 有任何疑惑可以回复我~ 2021-08-17 11:52:46
刘果国 2021-08-13 09:08:47

首先没太理解你的做法,为什么搞这么多habor的入口呢?还是部署了好几个harbor?另外个别节点有问题最好的办法是比对,有好的打样比较容易排查

0 回复 有任何疑惑可以回复我~
  • 提问者 惜福7840346 #1
    我是跟着视频做的呀,配置两台 worker,安装 harbor ,然后可以独立访问,一台 master 安装 nginx ,然后配置,然后不可以正常跳转到 harbor
    回复 有任何疑惑可以回复我~ 2021-08-13 09:12:56
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信