简体   繁体   English

如何获取nginx正在使用的当前工作连接?

[英]How to get current worker connections being used by nginx?

Nginx.conf, looks like this Nginx.conf,看起来像这样

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.命令ulimit -n给出了可用的工作连接数,我想要 nginx 当前正在使用的数字。

The ngx_http_stub_status_module module provides access to basic status information. ngx_http_stub_status_module模块提供对基本状态信息的访问。

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来源:https ://nginx.org/en/docs/http/ngx_http_stub_status_module.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM