Nginx's load balancing strategy can be divided into two categories: built-in policies and extension strategies. Built-in policies include weighted polling and IP hashes, which, by default, are compiled into the Nginx kernel, simply by specifying the parameters in the Nginx configuration. There are many extension strategies, such as fair, universal hash, consistent hash, etc., by default not compiled into the Nginx kernel.
First, we introduce the reverse proxy of nginx. A proxy server is generally classified as a forward proxy (usually directly referred to as a proxy server) and a reverse proxy.
Let's draw a picture so we can understand it.
Forward Proxy: You can imagine the kind of router that we're going to use to surf the Internet. (can be said to be agent of the client)
Reverse proxy: The client's request comes over to the reverse proxy server, and then the reverse proxy server is handed back to the real server in the background. (This is the server-side proxy)
What we are talking about today is the implementation of Nginx's reverse proxy function. At the same time, the reverse proxy can also achieve load balancing function. You can think for yourself.
The above describes the Nginx load balancing strategy and the principle of the direction of the agent, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.