: This article mainly introduces nginx server load balancer. if you are interested in the PHP Tutorial, refer to it. 1. concept of server load balancer
Server load balancer is built on the existing network structure, it provides a cheap, effective, and transparent method to expand the bandwidth of network devices and servers, increase throughput, enhance network data processing capabilities, and improve network flexibility and availability. Server Load balancer (Load Balance) is distributed to multiple operation units for execution. for exampleWeb server, FTP server, enterprise key application server, and other key task server to complete the work together.
2. nginx. conf configuration
In nginx. conf, configure upstream xxxa to load http and server configurations, and set the reverse proxy's porxy_pass to http: // xxxa. In fact, when multiple servers are built, a cluster is formed.
# Server load balancer list upstream meigang {server127.0.0.1: 8000; server127.0.0.1: 8001 ;}
# Reverse proxy location/{proxy_pass http: // meigang; proxy_redirect off; proxy_set_header Host $ host; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ response; client_max_body_size 10 m; limit 128 k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4 k; proxy_buffers 432 k; limit 64 k; limit 64 k ;}
Start 8001 and 80002 projects, and then start nginx.
3. access results
Enter http: // localhost in the browser and view the Project Log output. you can see that both projects are accessed.
4. some problems
In general projects, sessions are used to store some common object information. However, in the cluster environment, session sharing is involved. This problem will be solved in subsequent blogs. Coming soon.
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above introduces the load balancing of nginx, including the Web server content, and hope to be helpful to friends who are interested in PHP tutorials.