什么是“反向代理"?和“负载平衡"用Nginx/Web服务器术语? [英] What is "Reverse Proxy" and "Load Balancing" in Nginx / Web server terms?

查看:83
本文介绍了什么是“反向代理"?和“负载平衡"用Nginx/Web服务器术语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我经常听到的两个短语,主要与Nginx相关.有人可以给我一个外行的定义吗?

These are two phrases I hear about very often, mainly associated with Nginx. Can someone give me a laymans defintion?

推荐答案

定义通常很难理解.我想您只需要对其用例进行一些解释.

Definitions are often difficult to understand. I guess you just need some explanation for their use case.

一个简短的解释是:负载平衡是反向代理的功能之一,而反向代理是可以进行负载平衡的软件之一.

A short explanation is: load balancing is one of the functionalities of reverse proxy, and reverse proxy is one of the softwares that can do load balancing.

下面将给出详细解释.

例如,贵公司的服务拥有英国和德国的客户.因为这两个国家/地区的政策不同,所以您的公司有两个Web服务器,英国的uk.myservice.com和德语的de.myservice.com,每个都有不同的业务逻辑.此外,您的公司希望该服务只有一个统一的终结点myservice.com.在这种情况下,您需要将反向代理设置为统一端点.代理使用URL myservice.com,并重写传入请求的URL,以便来自UK(由源ip确定)的请求转到uk.myservice.com,来自德语的请求转到de.myservice.com.从英国的一位客户的角度来看,它永远不知道响应实际上是从uk.myservice.com产生的.

For example a service of your company has customers in UK and German. Because the policy is different for these two countries, your company has two web servers, uk.myservice.com for UK and de.myservice.com for German, each with different business logic. In addition, your company wants there to be only one unified endpoint, myservice.com for the service. In this case, you need to set up a reverse proxy as the unified endpoint. The proxy takes the url myservice.com, and rewrites the url of incoming requests so that requests from UK(determined by source ip) go to uk.myservice.com and requests from German go to de.myservice.com. From the view of a client from UK, it never knows the response is actually generated from uk.myservice.com.

在这种情况下,服务的请求流量负载实际上平衡到uk.myservice.com和de.myservice.com上的服务器.因此,我们通常不称其为负载均衡器,而只是说它为反向代理.

In this case, the load of request traffic to the service is actually balanced to servers on uk.myservice.com and de.myservice.com as a side effect. So we normally don't call it used as a load balancer, just say it as a reverse proxy.

但是可以说,如果您的公司在所有国家/地区都使用相同的策略,并且拥有2台服务器a.myservice.com和b.myservice.com,仅是因为一台服务器计算机的工作负担很重.在这种情况下,我们通常将反向代理称为负载平衡器,以强调使用反向代理的原因.

But lets say if your company uses the same policy for all countries, and has 2 servers, a.myservice.com and b.myservice.com, only for the reason that the work load is to heavy for one server machine. In this case, we normally call the reverse proxy as load balancer to emphasize the reason why it is being used.

这篇关于什么是“反向代理"?和“负载平衡"用Nginx/Web服务器术语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆