Complete the code to enable the stub status location in nginx configuration.
location /nginx_status {
[1]
}The directive to enable stub status is stub_status; inside a location block.
Complete the code to allow access only from localhost to the stub status page.
location /nginx_status {
stub_status;
allow [1];
deny all;
}To restrict access to localhost, use the IP address 127.0.0.1 in the allow directive.
Fix the error in this nginx configuration snippet to correctly enable stub status.
location /status {
stub_status [1]
}The stub_status directive does not take parameters. It must be followed by a semicolon only.
Fill both blanks to create a location block that enables stub status and restricts access to localhost.
location /nginx_status {
[1];
[2] 127.0.0.1;
deny all;
}The stub_status directive enables the status page, and allow 127.0.0.1; restricts access to localhost.
Fill both blanks to create a dictionary comprehension that filters stub status metrics with values greater than zero.
metrics = { [2]: [1] for [3], [2] in status.items() if [2] > 0 }This dictionary comprehension creates a new dictionary with keys and values from status.items(), filtering values greater than zero.