0
0
Nginxdevops~10 mins

Upstream blocks 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 define an upstream block named 'backend'.

Nginx
upstream [1] {
    server 192.168.1.10:80;
    server 192.168.1.11:80;
}
Drag options to blanks, or click blank then click option'
Abackend
Bproxy
Cserver_group
Dupstream_block
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved keywords as the name
Using spaces in the name
2fill in blank
medium

Complete the code to use the upstream block 'backend' in a server location.

Nginx
location /api/ {
    proxy_pass http://[1];
}
Drag options to blanks, or click blank then click option'
Aserver_group
Bproxy
Cbackend
Dupstream_block
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong upstream name
Omitting the 'http://' prefix
3fill in blank
hard

Fix the error in the upstream block by completing the missing directive.

Nginx
upstream backend {
    server 192.168.1.10:80;
    [1] 192.168.1.11:80;
}
Drag options to blanks, or click blank then click option'
Aserver
Blocation
Clisten
Dproxy_pass
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'proxy_pass' inside upstream
Omitting 'server' keyword
4fill in blank
hard

Fill both blanks to configure load balancing with least connections and set max fails.

Nginx
upstream backend {
    [1] 192.168.1.10:80 max_fails=3 fail_timeout=30s;
    [2] 192.168.1.11:80 max_fails=3 fail_timeout=30s;
    least_conn;
}
Drag options to blanks, or click blank then click option'
Aserver
Blisten
Cproxy_pass
Dlocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'listen' or 'proxy_pass' instead of 'server'
Missing 'server' keyword on one line
5fill in blank
hard

Fill all three blanks to create an upstream block with weighted servers and health checks.

Nginx
upstream backend {
    [1] 192.168.1.10:80 weight=5 max_fails=2 fail_timeout=20s;
    [2] 192.168.1.11:80 weight=3 max_fails=2 fail_timeout=20s;
    [3] 192.168.1.12:80 weight=2 max_fails=2 fail_timeout=20s;
}
Drag options to blanks, or click blank then click option'
Aserver
Blisten
Cproxy_pass
Dlocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'listen' or 'proxy_pass' instead of 'server'
Mixing directives inside upstream block