In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how Nginx configures statistical traffic bandwidth requests and records the status of real-time requests. The editor finds it very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The method of configuring Nginx to count traffic bandwidth requests and record real-time request status
Traffic bandwidth request status statistics
Ngx_req_status is used to display nginx request status information. The module included in status,nginx similar to apache can only display information such as the number of connections. We do not know which requests are made and how much bandwidth is consumed by each url domain name. Ngx_req_status provides these functions.
Functional characteristics
Statistics by domain name, url, ip, etc.
Total statistical flow
Statistics of current bandwidth\ Peak bandwidth
Count the total number of 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
two。 Configuration
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. Instruction
Req_status_zone
Syntax: req_status_zone name string size
Default value: None
Configuration block: http
Define the request status ZONE, which is arranged by string grouping, for example:
Req_status_zone server_url $server_name$uri 256k
The domain name + uri will form a piece of data, and you can see the bandwidth, traffic, and visits of all url.
Req_status
Syntax: req_status zone1 [zone2]
Default value: None
Configuration block: http, server, location
By enabling request status in location, you can specify more zones.
Req_status_show
Syntax: req_status_show on
Default value: None
Configuration block: location
Display data
Record request status information in real time
Ngx_realtime_request is a module used by nginx to count the traffic of virtual hosts. First of all, this module is based on the domain name. It will record the number of requests, bytes sent, and the number of http status codes returned by the domain name. The features are as follows:
Based on domain name record
Record the amount of data requested
Record send and response traffic
The record returns statistics of various http status codes
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
two。 Instruction (directives)
Realtime_zonesize
Syntax: realtime_zonesize size
Default value: 4m
Configuration block: http
Set the slab size
Realtime_request
Syntax: realtime_request [on/off]
Default value: none
Configuration block: location
Turn on statistics
3. Configure an instance
Http {
Realtime_zonesize 16m
Server {
Server_name www.jb51.net
Location ~ / ttlsa-rt-status {
Realtime_request on
}
}
}
This is the end of the article on "how to configure Nginx to count traffic bandwidth requests and record the status of real-time requests". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.