安装nginx时安装http_stub_status_module

1. 下载tengine源码包,解压
   axel http://tengine.taobao.org/download/tengine-2.1.2.tar.gz && tar -zxf tengine-2.1.2.tar.gz && cd tengine-2.1.2
2. 下载pcre8.37(请从下列网页查找下载连接),解压
   http://sourceforge.net/projects/pcre/files/pcre/8.37/
3. 进入到tengine-2.1.2目录下且运行下面的语句
   ./configure --prefix=/etc/nginx --with-http_upstream_check_module --with-http_stub_status_module   --with-pcre={pcre-8.37的目录}
4. 编译并安装nginx
>make && make install

5. 修改nginx的配置文件
   
server {
        listen 80;
        server_name localhost;
        location /nginx_status {
                stub_status on;
                access_log   off;
        }
}


6. 重启nginx
/etc/nginx/sbin/nginx -s stop
/etc/nginx/sbin/nginx
7. 测试配置是否成功
curl 127.0.0.1/nginx_status

如果成功的话应该看到下面信息:
Active connections: 291
server accepts handled requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106

猜你喜欢

转载自xiaoxiaoxiqincai.iteye.com/blog/2270140