Nginx, known for its high performance and scalability, supports a variety of modules including the ngx_http_stub_status_module. This module provides basic status information about Nginx via a status page.
To check if the ngx_http_stub_status_module is enabled, use the following command:
nginx -V 2>&1 | grep -o with-http_stub_status_module

If confirmed, edit the Nginx configuration file /etc/nginx/nginx.conf to set up a URL for the status page:
location /nginx_status {
stub_status;
allow 127.0.0.1; # only allow requests from localhost
deny all; # deny all other hosts
}

Replace 127.0.0.1 with your server’s IP address. Ensure this page is accessible only to authorized users.
After making configuration changes, validate the Nginx configuration for any errors:
nginx -t
If the configuration is okay, reload Nginx to apply the changes:
nginx -s reload
You can now access the Nginx status page using curl to view metrics:
curl http://127.0.0.1/nginx_status
Or, if accessible via a domain:
curl http://www.example.com/nginx_status

This setup allows you to monitor crucial Nginx metrics including active client connections, total requests, and the number of reading, writing, and waiting connections.