0
0
Nginxdevops~10 mins

IP hash for session persistence in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable IP hash load balancing in nginx.

Nginx
upstream backend {
    [1];
    server backend1.example.com;
    server backend2.example.com;
}
Drag options to blanks, or click blank then click option'
Around_robin
Bip_hash
Cleast_conn
Dhash
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'round_robin' which is the default but does not provide session persistence.
Using 'hash' which requires a key and is different from ip_hash.
2fill in blank
medium

Complete the nginx server block to proxy requests to the IP hash upstream.

Nginx
server {
    listen 80;
    location / {
        proxy_pass http://[1];
    }
}
Drag options to blanks, or click blank then click option'
Abackend1
Bproxy
Cupstream1
Dbackend
Attempts:
3 left
💡 Hint
Common Mistakes
Using a server name instead of the upstream block name.
Using an undefined upstream name.
3fill in blank
hard

Fix the error in this nginx upstream block to correctly enable IP hash.

Nginx
upstream backend {
    [1];
    server backend1.example.com;
    server backend2.example.com;
}
Drag options to blanks, or click blank then click option'
Aip_hash
Bip_hashing
Ciphash
Dhash
Attempts:
3 left
💡 Hint
Common Mistakes
Adding 'on' after ip_hash which causes a syntax error.
Using incorrect directive names like 'iphash' or 'ip_hashing'.
4fill in blank
hard

Fill both blanks to configure nginx to use IP hash and set a server with a specific port.

Nginx
upstream backend {
    [1];
    server backend1.example.com[2];
    server backend2.example.com;
}
Drag options to blanks, or click blank then click option'
Aip_hash
B:8080
C:80
Dleast_conn
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'least_conn' instead of 'ip_hash'.
Omitting the colon before the port number.
5fill in blank
hard

Fill all three blanks to create a complete nginx configuration for IP hash session persistence with two backend servers on different ports.

Nginx
upstream backend {
    [1];
    server backend1.example.com[2];
    server backend2.example.com[3];
}
Drag options to blanks, or click blank then click option'
Aip_hash
B:8080
C:9090
Dleast_conn
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'least_conn' instead of 'ip_hash'.
Forgetting the colon before port numbers.
Using the same port for both servers.