凉城的夜 2019-08-29 15:40 采纳率: 0%
浏览 1765

nginx如何转发相同请求到不同服务器

nginx转发

nginx 怎么可以实现,相同的一次请求,分发给两台不同的服务器,比如请求A,同时将这个请求转发给服务器B,和服务器C。

一个相同的请求想同时转发到:

http://a:api/;

http://b:api/;

  • 写回答

1条回答 默认 最新

  • duwei_880505 2019-09-10 10:49
    关注

    在代理服务器上配置 vim /usr/local/nginx/conf/nginx.conf 在http模块里添加
    将后端服务器如192.168.7.90添加至代理服务器里面

    upstream test {
    server 192.168.7.90;
    }
    在location里添加 proxy_pass http://test;
    location / {
    proxy_pass http://test;
    root html;
    index index.html;
    }

    评论

报告相同问题?