Kill lui lei dog---linux no:41 Linux under nginx cluster and load balancer

Source: Internet
Author: User

Clusters, such as buying a generation to push the server down and put a piece he's quite a cluster, and load balancing is to get this big bunch of servers to work on average. He is called load Balancer, as shown in:

For example, I use 192.168.8.155 to act as a pic host 1 and PIC Host 2 with Server A, 192.168.8.166, and 192.168.8.177来 as follows:

Then start modifying the nginx.conf file under Server A (192.168.8.155) Conf directory:

    upstream imgserver{        192.168.8.166:80 weight=1 max_fails=2 fail_timeout=30s;         192.168.8.177:80 weight=1 max_fails=2 fail_timeout=30s;     ~ \. (jpg|jpeg|png| gif) $ {            Proxy_set_header X-forwarded-for$remote _addr;             # proxy_pass http://192.168.8.166:80;            Proxy_pass http://imgserver;        }

Then go back to the Sbin directory with the./nginx-s reload reset under Configuration.

Then we test the access to server A to see the changes between the address and the image:

OK, configuration complete, this is the legendary load balancer and cluster.

Kill lui lei dog---linux no:41 Linux under nginx cluster and load balancer

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.