Skip to content

Monitor nginx status

Enable status page in configuration

Inside nginx main configuration file (usually, /etc/nginx/nginx.conf) or in a sub-file inside conf.d directory, insert this directive in main server block:

server {

    [...]

    location = /webserver_status {
        stub_status;
    }

    [...]

}

After changing nginx configuration files, test new settings via

nginx -t
before apply, reload or restart the service.

If a output like the following is shown, everything is ok and it's safe to apply changes.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Test from command line

To quickly test status page output from command line, run

curl http://localhost/webserver_status

Status will appear:

Active connections: 1
server accepts handled requests
 3 3 3
Reading: 0 Writing: 1 Waiting: 0