0
0
Nginxdevops~10 mins

Backup servers 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 a backup server in the upstream block.

Nginx
upstream backend {
    server backend1.example.com;
    server [1] backup;
}
Drag options to blanks, or click blank then click option'
Abackend2.example.com
Bbackend3.example.com
Cbackend4.example.com
Dbackend5.example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to add the 'backup' keyword after the server address.
Using the wrong server address.
2fill in blank
medium

Complete the code to set the proxy_pass directive to use the upstream group.

Nginx
location / {
    proxy_pass http://[1];
}
Drag options to blanks, or click blank then click option'
Alocalhost
Bbackend1.example.com
Cbackend
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Using a server address instead of the upstream group name.
Forgetting to use the upstream group name.
3fill in blank
hard

Fix the error in the upstream block to correctly mark the backup server.

Nginx
upstream backend {
    server backend1.example.com;
    server backend2.example.com [1];
}
Drag options to blanks, or click blank then click option'
Asecondary
Bbackup_server
Cstandby
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect keywords like 'backup_server' or 'secondary'.
Omitting the backup keyword.
4fill in blank
hard

Fill both blanks to define two servers, one main and one backup, in the upstream block.

Nginx
upstream backend {
    server [1];
    server [2] backup;
}
Drag options to blanks, or click blank then click option'
Amain.example.com
Bbackup.example.com
Cprimary.example.com
Dsecondary.example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping main and backup servers.
Not adding the backup keyword to the backup server.
5fill in blank
hard

Fill all three blanks to create a dictionary of servers with their status, marking the backup server correctly.

Nginx
servers = {
    '[1]': 'active',
    '[2]': 'backup',
    '[3]': 'active'
}
Drag options to blanks, or click blank then click option'
Aserver1.example.com
Bserver2.example.com
Cserver3.example.com
Dserver4.example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Marking the wrong server as backup.
Using the same server twice.