stub_status

The 'stub_status' directive enables a simple status monitoring page for NGINX.

Syntaxstub_status;
Defaultnone
Contextserver, location
Argumentsnone

Description

The 'stub_status' directive provides a way to expose NGINX's basic status information, including active connections, server accepts, handled requests, and requests served. It requires a location block in the server context where it can be accessed, typically under a specific URI. When a client accesses the configured URI, NGINX responds with the current status information in a plain text format.

To use 'stub_status', first, you need to define a location block within a server block. Inside this location, you enable 'stub_status' with no additional arguments. This access can be restricted by using access control directives such as 'allow' and 'deny', ensuring that only specific clients can query the status page. When enabled, the handler processes requests to this location and returns a response with metrics including the number of active connections, server accepts, handled requests, and total requests, providing valuable insights for monitoring and debugging the NGINX server's performance.

Config Example

server {
    listen 80;
    location /nginx_status {
        stub_status;
        allow 127.0.0.1;  # Only allow local requests
        deny all;         # Deny all other requests
    }
}

Ensure access controls ('allow' and 'deny') are properly set; otherwise, the status page may be exposed to unauthorized users.

Confirm that the location block for 'stub_status' is set correctly and is not overridden by other location directives.

Monitor the server's performance metrics in a secure manner; exposing stub statuses without restrictions may lead to information leakage.

← Back to all directives