Using the Stub Status module

NGINX provides an introspection module that outputs certain statistics about how it is running. This module is called stub_status and is enabled with the --with-http_stub_status_module configure flag.

To see the statistics produced by this module, the stub_status directive needs to be set to on. A separate location directive should be created for this module so that an ACL may be applied:

location /nginx_status {

    stub_status on;

    access_log off;

    allow 127.0.0.1;

    deny all;

}

Calling this URI from the localhost (for example, with curl http://localhost/nginx_status) will show output similar to the following lines:

Active connections: 2532
server accepts handled requests
1476737983 1476737983 3553635810
Reading: 93 Writing: ...

Get Mastering NGINX - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.