Skip to content

Usage of Nginx module http_stub_status_module

1、进入nginx源码目录,重新配置编译参数

./configure --prefix=/usr/local/nginx/ --with-http_stub_status_module

2、重新编译安装

make && make install

3、重启nginx

pkill -9 nginx
/usr/local/nginx/sbin/nginx

4、为了便于在网页上查看统计信息,在配置文件nginx.conf中加入

location /status {
      stub_status on;
      access_log off;
}

5、重新加载nginx

/usr/local/nginx/sbin/nginx -s reload

6、页面查看地址:http://ip/status

统计结果类似:

Active connections: 2001 
server accepts handled requests
 303662 303484 209204 
Reading: 0 Writing: 1073 Waiting: 928 

7、为了使nginx能够相应足够多的请求,要保证系统可同时打开文件数量足够多

ulimit -n 20480