Nginx Configure statistical traffic bandwidth requests and record real-time request status _nginx

Source: Internet
Author: User
Tags zip

Traffic Bandwidth Request Status statistics
Ngx_req_status used to show Nginx request status information, similar to the Apache Status,nginx module can only display the number of connections and so on information, we do not know exactly what the request, and each URL domain name consumption of the amount of bandwidth. Ngx_req_status provides these features.
Functional characteristics
Statistics by domain name, URL, IP, and so on
Statistic Total Flow
Statistics current bandwidth \ Peak Bandwidth
Total number of Statistics requests
1. Installation

# 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. Configure

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.jb51.net;
 Location/ttlsa-req-status {
 req_status_show on;
 }
 }
 }

3. Instructions
Req_status_zone
Syntax: Req_status_zone name string size
Default value: None
Configuration block: http
Defines the request status zone, which the request arranges by string grouping, for example:
Req_status_zone server_url $server _name$uri 256k;
Domain +uri will form a data, you can see all the URL bandwidth, traffic, access number
Req_status
Syntax: Req_status zone1[Zone2]
Default value: None
Configuration block: HTTP, server, location
To enable request status in location, you can specify more zones.
Req_status_show
Syntax: Req_status_show on
Default value: None
Configuration Block: Location
Show data

Real-time Logging request status information
Ngx_realtime_request is the nginx used to statistics virtual host traffic module, first and everyone said this module is based on domain name, will record the request amount of this domain name, send bytes, return the number of HTTP status code, characteristics are as follows:
Based on domain name records
Record Request data Amount
Record send, response traffic
Records return various HTTP status code statistics
1. Installation

# 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. Instruction (Directives)
realtime_zonesize
Syntax: Realtime_zonesize size
Default value: 4m
Configuration block: http
Set Slab size
Realtime_request
Syntax: realtime_request [On/off]
Default value: None
Configuration Block: Location
Turn on statistics
3. Configuration Instance

HTTP {
  realtime_zonesize 16m;
 
  server {
    server_name www.jb51.net
    location ~/ttlsa-rt-status {
      realtime_request on;
    }
}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.