Forward agent

Configure a proxy server on the client (browser) to access the Internet through the proxy server. The proxy object is the client without knowing who the server is.

The common forward proxy application scenarios, such as VPN, are on the client. For example, we need to visit some foreign websites, but the speed of domestic access is too slow. For this, we may need VPN.

And the VPN is set up on the user’s browser (not on the remote server).

The browser accesses the VPN address, which forwards the request and returns the result.

The reverse proxy

The client does not need any configuration to access, just need to send the request to the reverse proxy server, the reverse proxy server to select the target server, and then return the data to the client. The IP address of the reverse proxy server is exposed and the IP address of the real server is hidden. The proxy object is the server without knowing who the client is.

The reverse proxy is a virtual IP address (VIP) on the server. A request from the user is forwarded to one of several backend processors to process the specific request.

Nginx reverse proxy and load balancing, static and static separation

Load balancing

The client sends multiple requests to the server, which processes the requests, some of which may access a database, and then returns the results to the client. This architecture mode is simple and suitable for the case of few concurrent requests, but how to solve the case of large concurrent requests?

May first think of upgrading the server configuration, but the hardware performance cannot meet the increasing demand, at this time of the server cluster, and increase the number of servers, and then will request the context of a single server instead of the original distributed to multiple servers, load distribution to multiple servers, we speak of load balancing. Nginx can act as a load balancer.

Dynamic and static separation

In order to speed up the resolution of the website, dynamic pages and static pages can be resolved by different servers, reducing server pressure, speed up the resolution.

Application of nGINx reverse proxy load balancing in actual scenarios

For example, routes of different versions of interfaces are distributed. Routes for/APiv1 are forwarded to server A, and routes for/APiv2 are forwarded to server B. For example, a website uses nginx on the server to forward the route of /webapi to a port on the javaweb server, and forwards /aiapi to a port on the server that provides artificial intelligence image recognition.

conclusion

The difference between forward and reverse proxies is whether the proxy is on the client side or the server side. Nginx software can be installed on the server as a reverse proxy server and distributed to different server IP addresses according to different routes to achieve load balancing, so as to improve website performance and higher concurrent requests.

To admire the