0
0
Nginxdevops~20 mins

Debug mode in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Debug Mode Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Enable debug logging in nginx configuration
You want to enable debug logging in nginx to troubleshoot request handling. Which directive correctly enables debug logging in the main nginx configuration file?
Aerror_log /var/log/nginx/error.log debug;
Baccess_log /var/log/nginx/access.log debug;
Clog_level debug;
Ddebug_log /var/log/nginx/debug.log;
Attempts:
2 left
💡 Hint
Debug logging in nginx is controlled by the error_log directive with a specific log level.
💻 Command Output
intermediate
2:00remaining
Check if debug mode is active in nginx
After enabling debug logging, you want to verify if nginx is running with debug mode active. Which command output confirms debug mode is enabled?
Nginx
nginx -V
Adebug=true
Berror_log set to debug
Cdebug_mode=on
Dbuilt with --with-debug
Attempts:
2 left
💡 Hint
Check the nginx build options to see if debug support is compiled in.
Configuration
advanced
3:00remaining
Configure debug logging only for a specific location
You want to enable debug logging only for requests to the /api location in nginx, without affecting other locations. Which configuration snippet achieves this?
A
location /api {
    error_log /var/log/nginx/api_error.log debug;
}
B
error_log /var/log/nginx/api_error.log debug;
location /api {}
C
location /api {
    access_log /var/log/nginx/api_access.log debug;
}
D
location /api {
    debug_log /var/log/nginx/api_debug.log;
}
Attempts:
2 left
💡 Hint
The error_log directive can be set inside a location block to control logging for that location.
Troubleshoot
advanced
3:00remaining
Debug logs not appearing after enabling debug mode
You enabled debug logging in nginx with error_log /var/log/nginx/error.log debug; but no debug messages appear in the log. What is the most likely cause?
AThe log file path is incorrect and nginx cannot write logs
BThe error_log directive must be in the http block, not main
Cnginx was not compiled with --with-debug option
DDebug logging requires restarting the server with --debug flag
Attempts:
2 left
💡 Hint
Check if your nginx binary supports debug mode by build options.
Best Practice
expert
3:00remaining
Best practice for enabling debug mode in production nginx
You need to enable debug logging temporarily on a production nginx server to troubleshoot an issue. What is the best practice to minimize impact?
AEnable debug logging globally and restart nginx to apply changes
BEnable debug logging only for the affected location and reload nginx configuration
CEnable debug logging and leave it on permanently for continuous monitoring
DStop nginx, enable debug logging, then start nginx to avoid partial logs
Attempts:
2 left
💡 Hint
Limit debug logging scope and avoid full restarts in production.