Nginx Load Balancer Configuration Example

Source: Internet
Author: User

Example of an nginx load balancer configuration. The configuration examples for load balancing are as follows:



Http{   upstream server {     server 192.168.10.100:80  weight=3 max_fails=3 fail_timeout=25s;     server  192.168.10.101:80 weight=1 max_fails=3 fail_timeout=25s;     server  192.168.10.102:80 weight=4 max_fails=3 fail_timeout=25s;      server 192.168.10.103:80 weight=2 max_fails=3 fail_timeout=25s;      }   server {   listen 80;   server_name   ;    index index.htm index.html;   root /d21414/web/ Www;location / {     proxy_pass      proxy_ next_upstream http_500 http_502 http_503 error timeout invalid_headerl      include /etc/nginx/proxy.conf;      }   }} 


Note:

    1. Configure load Balancing using the Nginx keyword to identify the upstream. A Load Balancer server server (name is optional) is specified through upstream.

2. Use the Proxy_next_upstream parameter to define the fault error. When a node returns an error such as 500. Upstream will be forwarded to weight (the higher the weight value, the higher the access probability assigned).

This article from "10998982" blog, declined reprint!

Nginx Load Balancer Configuration Example

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.