随笔 - 103,  文章 - 0,  评论 - 1,  阅读 - 16万

配置权重

upstream tomcats {
  server 172.21.13.165:8088 weight=10;
  server 172.21.13.81:8088 weight=1;
}

server {
  listen 80;

  #绕过跨域 这样后端那些接口需要跨域也不用单独配置了。这样 web 页面请求自己当前域名下的request就被转发到内网的服务上去了。

  location / {
    proxy_pass http://tomcats;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  }

}

其他负载均衡策略百度即可

posted on   独醉笑清风  阅读(152)  评论(0编辑  收藏  举报
努力加载评论中...
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示