Configuration and optimization of nginx load balancing and reverse proxy

Source: Internet
Author: User
Tags nginx load balancing
Server Load balancer

Server Load balancer is a server set composed of multiple servers in a symmetric manner. Each server is equivalent,

Reverse Proxy

A proxy server is used to receive requests from the Internet and then forward the requests to an internal server.

Common Load Balancing

1. manually select the download site,

2. disadvantages of DNS round robin: low reliability and load imbalance

3. layer-4 and layer-7 Load Balancing Devices

The configuration is as follows:

Server Cluster upstream 192.168.0.4 {# server cluster name server 172.16.21.13: 8081 Weight = 1; # server configuration weight indicates weight. A higher weight indicates a higher probability of allocation. Server 192.168.1.186: 8081 Weight = 1; server 192.168.0.101: 80 Weight = 5; server 192.168.0.102: 80 Weight = 1 ;}

Server Configuration

Location/{# the backend returns an error such as 502 404 execution timeout. The request is automatically forwarded to proxy_next_upstream http_502 http_404 error timeout invalid_header; proxy_pass http: // 192.168.0.4; # Autoindex on; # proxy_redirect default; proxy_set_header host $ host; proxy_hide_header server; # Hide header proxy_set_header X-powered-by nginx; index index.html ;}

HTTP upstream Module

The upstream module is the main module of the nginx Load Balancing module. It provides a simple method to achieve load balancing between the client and the IP.

Server commands

Weight refers to the weight of the server. The higher the weight, the more requests are allocated to the server.

 

Configuration and optimization of nginx load balancing and reverse proxy

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.