Enabling the stats page in NginX
To enable the NginX stats page, add these lines to the nginx.conf config file, or the file where your sites are described. Add them inside the server { ... } section:
location /statistics {
# Turn on nginx stats
stub_status on;
# I do not need logs for stats
access_log off;
# Send rest of the world to /dev/null #
#deny all;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth/.htpasswd;
}
The last two lines are there to cover the stats page with a simple login form. No need to show it to everyone.
Next, check the Nginx config:
nginx -t
If everything’s OK, restart:
/etc/init.d/nginx restart
Now going to http://www.website.com/statistics you’ll see this:
