Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current worker connections being used by nginx?

Tags:

nginx

ubuntu

Nginx.conf, looks like this

user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
        worker_connections 768;
        # multi_accept on;
}

The command ulimit -n gives the number of worker connections available, I want the number which is currently being used by nginx.

like image 649
Hardeep Mehta Avatar asked Sep 01 '16 06:09

Hardeep Mehta


1 Answers

The ngx_http_stub_status_module module provides access to basic status information.

location /basic_status {
    stub_status;
}

This configuration creates a simple web page with basic status data which may look like as follows:

Active connections: 291 
server accepts handled requests
 16630948 16630948 31070465 
Reading: 6 Writing: 179 Waiting: 106 

Source: https://nginx.org/en/docs/http/ngx_http_stub_status_module.html

like image 161
Tan Hong Tat Avatar answered Sep 21 '22 14:09

Tan Hong Tat