Two Methods to Check Nginx Concurrent Connection Counts
In production environments, more and more projects use Nginx as a web server. At the same time, we need to keep an eye on the Nginx status, such as checking the current concurrent connection count to ensure normal operation. This article shares two methods to check Nginx concurrent connection counts.

Method 1: Check via Web Interface
This method relies on the Nginx http_stub_status_module. You can check if the module is installed by running nginx -V. If it is not installed, you need to recompile Nginx with this module.

Add the following configuration within any of your server blocks:
location /status {
stub_status on;
}
After modifying the configuration, run the command nginx -t to ensure there are no syntax errors, and then reload the Nginx configuration with nginx -s reload to make it effective. You can then visit http://youdomain.com/status to view the connection status, as shown in the screenshot below.

The meanings of the parameters above are as follows:
- Active connections: The number of active connections currently being processed by Nginx (1186), which represents the current concurrent connection count.
- server accepts handled requests: The total number of connections processed (420484), successful handshakes created (420484 times), and total requests processed (408348).
- Reading: The number of header information read from the client by Nginx.
- Writing: The number of header information returned to the client by Nginx.
- Waiting: When keep-alive is enabled, this value equals
active - (reading + writing), meaning it represents the number of persistent connections that Nginx has processed and are waiting for the next request instruction.
Method 2: Check via Command Line
If you only want to simply check the current Nginx concurrent connection count without needing more detailed information, you can directly use the following command (netstat -apn | grep 'nginx: worker' | wc -l):
[root@rakcdn ~]# netstat -apn|grep 'nginx: worker'|wc -l
1096
References
Some content in this article is referenced from: NGINX: Check Concurrent Connection Count