Complete the code to set up a basic upstream block for load balancing.
upstream backend {
server 192.168.1.1[1];
}The correct syntax to specify a server with default settings is just the IP and optional port, like 192.168.1.1:80. Adding :80 specifies the port.
Complete the code to assign a weight of 3 to the server in the upstream block.
upstream backend {
server 192.168.1.2:80 [1];
}In nginx, weights are assigned using weight=number syntax with an equals sign and no spaces.
Fix the error in the upstream block to correctly assign weights to two servers.
upstream backend {
server 192.168.1.3:80 weight=2;
server 192.168.1.4:80 [1];
}Each server line must end with a semicolon. Also, weight assignment uses weight=number with no spaces after equals.
Fill both blanks to create an upstream block with two servers having weights 4 and 6.
upstream backend {
server 192.168.1.5:80 [1];
server 192.168.1.6:80 [2];
}Each server line must specify the weight with weight=number and end with a semicolon.
Fill all three blanks to configure an upstream with weighted round-robin load balancing.
upstream backend {
[1] 192.168.1.7:80 [2];
[3] 192.168.1.8:80 weight=7;
}Each server line starts with server. The first server has weight 5, the second weight 7. Weighted round-robin is the default when weights are specified.