控制台输出
[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;
}
}
请问这个我需要怎么处理??