docker配置 nginx实现负载均衡
Posted zhao-
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker配置 nginx实现负载均衡相关的知识,希望对你有一定的参考价值。
首先要准备三个nginx的容器;
第二个容器:
第三个容器:
进入第一个容器 要配置的容器(docker exec -it 容器名 /bin/bash)
vi /usr/local/nginx/conf/nginx.conf 修改配置
在http 中加入


退出然后重启服务,systemctl restart nginx
如果服务重启不行,就查看nginx进程
ps aux|grep nginx (运行后面的文件路径)
kill 进程
或者 重启docker也可以 ( docker restart 容器名称 )
运行命令
以上是关于docker配置 nginx实现负载均衡的主要内容,如果未能解决你的问题,请参考以下文章