Nginx性能统计模块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;
allow 127.0.0.1;
    deny all; }

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

 

posted @ 2018-01-16 19:08  sun111  阅读(1601)  评论(0编辑  收藏  举报