0
0
Nginxdevops~10 mins

Debug mode 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 debug logging in nginx configuration.

Nginx
error_log /var/log/nginx/error.log [1];
Drag options to blanks, or click blank then click option'
Aerror
Binfo
Cwarn
Ddebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' level which shows only errors, not debug info.
Using 'info' which is less detailed than debug.
2fill in blank
medium

Complete the code to enable debug mode for a specific nginx location block.

Nginx
location /test {
    [1] on;
}
Drag options to blanks, or click blank then click option'
Adebug_connection
Berror_log
Cproxy_debug
Ddebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'debug' which is not a valid directive here.
Using 'proxy_debug' which does not exist.
3fill in blank
hard

Fix the error in the nginx debug log directive to correctly enable debug logging.

Nginx
error_log /var/log/nginx/debug.log [1] debug;
Drag options to blanks, or click blank then click option'
Awarn
Berror
Coff
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving a log level before 'debug' causes syntax errors.
Using 'error' or 'warn' instead of 'off'.
4fill in blank
hard

Fill both blanks to configure nginx to log debug messages only for connections from localhost.

Nginx
error_log /var/log/nginx/error.log [1];
debug_connection [2];
Drag options to blanks, or click blank then click option'
Adebug
Binfo
Call
D127.0.0.1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'all' in debug_connection logs debug for all connections.
Using 'info' instead of 'debug' for error_log.
5fill in blank
hard

Fill all three blanks to create a map that enables debug logging only for requests from a specific IP.

Nginx
map $remote_addr $debug_mode {
    default [1];
    [2] [3];
}
Drag options to blanks, or click blank then click option'
Aoff
B192.168.1.100
Con
D127.0.0.1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting default to 'on' enables debug for all IPs.
Mixing IP addresses or using 'all' instead of a specific IP.