Load balancing for nginx

Source: Internet
Author: User
: 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.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.