docker创建三个容器,三个服务端口分别为224,1224,1225:
修改Nginx配置文件,添加反向代理upstream,实现负载均衡:
upstream zhieasy{
server 127.0.0.1:224;
server 127.0.0.1:1224;
server 127.0.0.1:1225;
}
server
{
listen 80;
listen 443 ssl http2;
server_name api.xxxxxxx.cn;
location / { # 访问路径配置
# root index;# 根⽬录
#反向代理,实现负载均衡
proxy_pass http://zhieasy;
index index.html index.htm; # 默认⾸⻚
}