nginx的https负载均衡

星泪成寒 发布于 2015/07/08 16:13
阅读 1K+
收藏 0

nginx怎么实现https负载均衡啊?

看下面的例子1,反向代理OK,例子2的负载均衡为什么不好用(过一段时间后返回502)

#例子 1
server {
    listen 80;

    location \ {
        proxy_pass https://www.baidu.com;
    }
}



# 例子2
upstream mybalance {
    server www.baidu.com;
}

server {
    listen 80;

    location \ {
        proxy_pass https://mybalance;
    }
}



加载中
0
Cleey
Cleey

你把 mybalance 换成 www.baidu.com试试

upstream mybalance > upstream www.baidu.com

0
lieefu
lieefu
http {
    upstream myapp1 {
        server srv1.example.com weight=3;
        server srv2.example.com;
        server srv3.example.com;
    }

    server {
        listen 80;
        location / {
            proxy_pass http://myapp1;
        }
    }
}



返回顶部
顶部