Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx records analyze slow response requests and how to configure the response content of a replacement website

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you about the Nginx record analysis slow response request and how to replace the website response content configuration of the relevant knowledge points, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you can learn something after reading this article, let's take a look at it.

1. Module installation

The installation method of nginx third-party module is skipped here.

Configuration parameters

. / configure-- prefix=/usr/local/nginx-1.4.1-- with-http_stub_status_module\-- add-module=../ngx_http_log_request_speed

two。 Instruction log_request_speed

2.1 log_request_speed_filter

Syntax:

Log_request_speed_filter [on | off]

Configuration segment: nUnix a

Context: location, server, http

Start or disable the module

2.2 log_request_speed_filter_timeout

Syntax:

Log_request_speed_filter_timeout [num sec]

Default: 5 seconds

Configuration segment: location, server, http

This is not a real timeout, but when a request exceeds the time given here, it will be recorded in the nginx error log. The default value is 5000 microseconds (5 seconds). If a request is less than 5 seconds, the request will not be logged, but if it exceeds 5 seconds, the request will be recorded in the error log of nginx.

3. Use an example

3.1 nginx configuration

Http {log_request_speed_filter on; log_request_speed_filter_timeout 3;...}

The slow requests recorded in the error log are as follows

3.2 Log analysis

Cd / usr/local/nginx-1.4.1/logswget http://wiki.nginx.org/images/a/a8/log_analyzer.tar.gztar-xzvf log_analyzer.tar.gzcd request_speed_log_analyzer# cat.. / error.log | grep 'process request' |. / analyzer.pl-rpost / wp-admin/admin-ajax.php http/1.1-avg ms: 1182, value count: 2get / shmb/1145.html http/1.1-avg ms: 2976, value count: 1

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report