Modifying Load Balancing Configuration for NGINX - CertifaiAI/deployment-course-labs GitHub Wiki

upstream command is used to name a group of servers. In this configuration, server_group is the name given to this particular group of servers which consists of my.server.com and my.server2.com. weight command is used to configure the number of request routed each server. You can configure weight value to modify how traffic is routed to different servers. By default, weight is set to 1.

In the configuration shown below, three of the incoming requests will be routed to my.server1.com followed by another request routed to my.server2.com, and then the cycle repeats. If none of the weight is set, traffic will be routed in a round-robin manner.

upstream server_group   {

server my.server1.com weight=3;

server my.server2.com;

}

server  {

location / {

proxy_pass http://server_group;

}

}

Reference

What is a Reverse Proxy?