在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
流量带宽请求状态统计 # cd /usr/local/src/ # wget "http://nginx.org/download/nginx-1.4.2.tar.gz" # tar -xzvf nginx-1.4.2.tar.gz # wget https://github.com/zls0424/ngx_req_status/archive/master.zip -O ngx_req_status.zip # unzip ngx_req_status.zip # cd nginx-1.4.2/ # patch -p1 < ../ngx_req_status-master/write_filter.patch # ./configure --prefix=/usr/local/nginx-1.4.2 --add-module=../ngx_req_status-master # make -j2 # make install 2. 配置 http { req_status_zone server_name $server_name 256k; req_status_zone server_addr $server_addr 256k; req_status_zone server_url $server_name$uri 256k; req_status server_name server_addr server_url; server { server_name test.ogeek.net; location /ttlsa-req-status { req_status_show on; } } } 3. 指令
req_status_zone 语法: req_status_zone name string size 默认值: None 配置块: http 定义请求状态ZONE,请求按照string分组来排列,例如: req_status_zone server_url $server_name$uri 256k; 域名+uri将会形成一条数据,可以看到所有url的带宽,流量,访问数 req_status 语法: req_status zone1[ zone2] 默认值: None 配置块: http, server, location 在location中启用请求状态,你可以指定更多zones。 req_status_show 语法: req_status_show on 默认值: None 配置块: location 展示数据 实时记录请求状态信息 # cd /usr/local/src/ # wget "http://nginx.org/download/nginx-1.4.2.tar.gz" # tar -xzvf nginx-1.4.2.tar.gz # wget https://github.com/magicbear/ngx_realtime_request_module/archive/master.zip -O ngx_realtime_request.zip # unzip ngx_realtime_request.zip # cd nginx-1.4.2/ # ./configure --prefix=/usr/local/nginx-1.4.2 --add-module=../ngx_realtime_request_module-master # make # make install 2. 指令(directives) http { realtime_zonesize 16m; server { server_name www.ogeek.net location ~ /ttlsa-rt-status { realtime_request on; } } } |
请发表评论