: This article mainly introduces the simple nginxloadbalance example. if you are interested in the PHP Tutorial, refer to it. MORE: http://www.webyang.net/Html/web/article_137.html
Nginx is configured to run in the form of a reverse proxy. the actual processing of the request needs to be forwarded to the backend server for execution. There may be one or more backend servers. how to select a suitable backend server to process the current request is nginx server load balancer.
Nginx can be used not only as a powerful web server, but also as a reverse proxy server. nginx can also implement dynamic and static page separation according to scheduling rules, server load balancer can be performed on backend servers by means of polling, ip hash, URL hash, and weight.
If the server crashes when there is only one server, it is a disaster for the website. Therefore, the server load balancer will be ready at this time, and it will automatically remove the suspended servers.
The Load-balance module is an auxiliary module and mainly serves the Upstream module. it has a clear and single goal: how to select a suitable server from multiple backend servers for processing.
Simple example:
- http {
- upstream myproject {
- server 127.0.0.1:8000 weight=3;
- server 127.0.0.1:8001;
- server 127.0.0.1:8002;
- server 127.0.0.1:8003;
- }
- server {
- listen 80;
- server_name www.domain.com;
- location /{
- proxy_pass http://myproject;
- }
- }
- }
You can configure other configurations as usual.
Today is the fifth day of the year. wish you a happy new year! In addition, learn together and make progress together ~
The above describes the simple nginx load balance example, including some content, and hope to be helpful to friends who are interested in the PHP Tutorial.