nginx load balancing simple configuration

Requirements:

Three servers

127.0.0.1 primary load (the partial access request to the host cell)

127.0.0.2 Host 2

127.0.0.3 host 3

first step:

Configuration 127.0.0.1 (primary load) host file nginx.conf 

The main pool is added to nginx.conf file in http

upstream mysvr{
  server 127.0.0.2 weight=1;
  server 127.0.0.3 weight=3;
}

Figure:

Hostpool parameters Introduction

Host weight for weight (FIG configured to access sequence ABBBABBBABBB ...)
backup to set an alternate host (When adding this setting after the first server host will be suspended to enable the Add Service Host access sequence backup for AAAA suddenly ... A dead BBBBBB )
* When setting the rules of the host cell will not perform the default polling namely weight = 1 access sequence (ABABABAB ...) 
there is not one by one to explain the rules more accessible https://www.runoob.com/w3cnote/nginx- proxy-balancing.html can see detailed

Step:
test load balancing whether the configuration
settings to resolve the domain name server is the primary load www.baidu.com
the primary load server (127.0.0.1) needs to be configured for the next FIG vhost:

the server 127.0.0.2 127.0.0.3 need to add www.baidu.com.conf simultaneously in two different vhost and configure access to the file
restart nginx save
there will be two different page refresh after visiting the domain name that is assuming that the configuration is successful

the first time to do load balancing, if flawed, please add in the comments that I qq2938795129 also welcome to ask questions Thank you ~ ~

Guess you like

Origin www.cnblogs.com/caopeng/p/11961901.html