Nginx load Balancing in CentOS

Source: Internet
Author: User
Tags nginx load balancing

Nginx powerful Web server, or reverse proxy server, and Nginx can also follow the schedule rules to achieve dynamic, static page separation, you can follow the polling, IP hash, url hash, weight and other ways to load balance the back-end server, but also support the health check of the backend server.

Nginx's upstream supports 5 load balancing methods:

1), polling (default)

Each request is assigned to a different back-end server in chronological order, and can be automatically rejected if the backend server is down.

2), Weight

Specifies the polling probability, proportional to the weight and access ratios, for situations where the performance of the backend server is uneven.

3), Ip_hash

Each request is allocated according to the hash result of the access IP, so that each visitor has fixed access to a back-end server that resolves the session issue.

4), Fair (third party)

The response time of the back-end server is allocated to the request, and the response time is short of priority allocation.

5), Url_hash (third party)


Simulation Scenario:

Two Web services (TOMCAT1 and TOMCAT2) were launched in CentOS

Native ip:192.168.33.195

TOMCAT1 Native: 192.168.33.192 Port: 8080

TOMCAT2 Native: 192.168.33.193 Port: 8080

Then modify the conf configuration file for the Nginx service to achieve the most basic load balancing

Note: Location inside to configure the site name Proxy_pass points to the upstream configuration

Enter Nginx's IP access as follows:

Nginx load Balancing in CentOS

Related Article

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.