What will happen if a client from IP 192.168.1.15 accesses /nginx_status?
medium
A. The client will download the nginx configuration file
B. The client will see nginx server statistics
C. The client will be redirected to the homepage
D. The client will get a 403 Forbidden error
Solution
Step 1: Analyze IP access rules
The configuration allows IPs in 192.168.1.0/24 and denies all others. IP 192.168.1.15 is inside this range, so access is allowed.
Step 2: Understand stub_status output
With access allowed, the client will see the nginx server statistics page generated by stub_status.
Final Answer:
The client will see nginx server statistics -> Option B
Quick Check:
Allowed IP + stub_status = stats page [OK]
Hint: Allowed IPs see stats; others get denied [OK]
Common Mistakes:
Ignoring IP allow/deny order
Assuming all IPs can access stub_status
Thinking stub_status redirects or downloads files
4. You configured nginx with:
location /status {
stub_status;
}
But when you visit /status, you get a 403 Forbidden error. What is the most likely cause?
medium
A. The stub_status directive is misspelled
B. Nginx does not support stub_status on this version
C. The location block is missing a root directive
D. Access is not restricted by allow/deny rules, so default deny applies
Solution
Step 1: Understand default access behavior
By default, nginx denies access if no allow/deny rules are set and the stub_status is enabled, causing 403 errors.
Step 2: Check other options
The stub_status directive is correct, root is not required for stub_status, and most nginx versions support stub_status.
Final Answer:
Access is not restricted by allow/deny rules, so default deny applies -> Option D
Quick Check:
No allow/deny means deny by default [OK]
Hint: Always add allow/deny rules to permit stub_status access [OK]
Common Mistakes:
Forgetting to add allow rules for trusted IPs
Assuming stub_status needs root directive
Blaming nginx version without checking
5. You want to monitor nginx server stats securely using stub status. Which configuration snippet correctly enables stub status at /status and restricts access only to localhost?
hard
A. location /status {
stub_status;
deny 127.0.0.1;
allow all;
}
B. location /status {
stub_status on;
allow all;
}
C. location /status {
stub_status;
allow 127.0.0.1;
deny all;
}
D. location /status {
stub_status;
allow 0.0.0.0/0;
}
Solution
Step 1: Enable stub_status correctly
Use stub_status; inside the location block without extra keywords.
Step 2: Restrict access to localhost
Allow only 127.0.0.1 and deny all others to secure access.
Step 3: Evaluate options
location /status {
stub_status;
allow 127.0.0.1;
deny all;
} correctly enables stub_status and restricts access. location /status {
stub_status on;
allow all;
} wrongly uses 'stub_status on;' and allows all. location /status {
stub_status;
deny 127.0.0.1;
allow all;
} denies localhost but allows all others, which is insecure. location /status {
stub_status;
allow 0.0.0.0/0;
} allows all IPs.