15

We want to check the number of active connections without the module HttpStubStatusModule being installed.

What would be the equivalent Linux command?

As a base line, we test on a machine with HttpStubStatusModule installed first, e.g.

Active connections: 6146 <-- from HttpStubStatusModule

# netstat -an | grep :80 | wc -l
1266

# netstat -an | grep :443 | wc -l
25082

It seems to me that none of the above netstat give me the correct figure.

Any idea?

Howard
  • 2,275

2 Answers2

18

Try excluding TIME_WAIT or grepping ESTABLISHED only

netstat -an | grep :443 | grep -v TIME_WAIT | wc -l

or

netstat -an | grep :443 | grep ESTABLISHED | wc -l
0

Add the following to the nginx server block

   location /nginx_status {
        # Turn on stats
        stub_status on;
        access_log   off;
        allow all;
   }

we can check the connections status using the below URL

http://site_url/nginx_status
or
http://ip_address/nginx_status