0
0
Nginxdevops~10 mins

Common error diagnosis 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 specify the main configuration file for nginx.

Nginx
nginx -c [1]
Drag options to blanks, or click blank then click option'
A/etc/nginx/nginx.conf
B/var/log/nginx/error.log
C/usr/share/nginx/html
D/etc/passwd
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log file path instead of the config file.
Using a directory path instead of a file.
Using unrelated system files.
2fill in blank
medium

Complete the command to test nginx configuration for syntax errors.

Nginx
nginx [1]
Drag options to blanks, or click blank then click option'
A-t
B-v
C-s
D-h
Attempts:
3 left
💡 Hint
Common Mistakes
Using -v which shows version info.
Using -s which sends signals to nginx.
Using -h which shows help.
3fill in blank
hard

Fix the error in the command to reload nginx after config changes.

Nginx
nginx -[1] reload
Drag options to blanks, or click blank then click option'
At
Bs
Cr
Dv
Attempts:
3 left
💡 Hint
Common Mistakes
Using -r which is not a valid option.
Using -t which tests config but does not reload.
Using -v which shows version.
4fill in blank
hard

Fill both blanks to create a dictionary of server names and their root directories from a list.

Nginx
servers = {name: [1] for name in server_names if name [2] 'example.com'}
Drag options to blanks, or click blank then click option'
A'/var/www/' + name
B==
C!=
Dlen(name)
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality instead of inequality in the condition.
Using length instead of path concatenation.
Confusing the order of operands.
5fill in blank
hard

Fill all three blanks to filter and transform nginx log entries into a dictionary.

Nginx
log_summary = [1]: int([2]) for [3] in logs if 'error' in [3]
Drag options to blanks, or click blank then click option'
A'error_count'
Bentry.split()[2]
Centry
D'error'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable name in the loop.
Using the wrong index when splitting the entry.
Using the string 'error' as a key instead of a fixed name.