Tested on Debian 7 / NGINX 1.10
You can watch the nginx connections stats compiling nginx with the option http_stub_status_module:
~ $ ./configure --sbin-path=/usr/local/sbin --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --with-http_ssl_module --with-http_addition_module --with-pcre-jit --with-http_stub_status_module
Make and install:
~ $ make && make install
Now add this to the section server in the vhost config:
location /nginx_status { stub_status on; access_log off; allow x.x.x.x; deny all; }
Where x.x.x.x is your IP address. Also you can protect URL by http auth:
location /nginx_status { stub_status on; access_log off; auth_basic "Auth required"; auth_basic_user_file /etc/nginx/htpasswd; }
Generate password file:
~ $ htpasswd -c /etc/nginx/htpasswd administrator New password: Re-type new password: Adding password for user administrator ~ $ cat /etc/nginx/htpasswd administrator:$apr1$kpTScFHe$A8W0.xtVq.gfiCY/9SdO71
Then reload nginx:
~ $ /etc/init.d/nginx reload
On load http://mydomain.com/nginx_status you will see:
Active connections: 2 server accepts handled requests xxx yyy zzz Reading: 0 Writing: 2 Waiting: 0
Where:
mydomain.com: is your domain
xxx: total accepted connections
yyy: total handled connections
zzz: total handled requests