Simple configuration of nginx Server Load balancer

Source: Internet
Author: User
Tags nginx server

CopyCodeThe Code is as follows: HTTP
{
Upstream www.test2.com {
Server 10.1.165.36: 80 Weight = 3;
Server 10.249.198.235;
Server 10.1.168.1 down;
Server 10.1.168.2 backup;
# Ip_hash;
}
Server
{
Location /{
Proxy_pass http://www.test2.com;
Proxy_set_header host $ host;
Proxy_set_header X-real-IP $ remote_addr;
Proxy_set_header X-forwarded-for $ proxy_add_x_forwarded_for;
}
}

For nginx Server Load balancer, you need to add upstream and proxy_pass to the server.

Server 10.1.165.36: 80 Weight = 3; indicates that the server will be accessed three times the same probability.
Server 10.1.168.1 down; not used currently
Server 10.1.168.2 backup; started only when the pressure is high
Ip_hash; use IP addresses for hash matching. However, there may be some drawbacks, such as nginx cannot obtain IP addresses if it is not on the outermost layer.
Proxy_pass http://www.test2.com represents the accessed URL

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.