欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來(lái)到云服務(wù)器

服務(wù)器租用

Nginx日志設(shè)置

日志對(duì)付統(tǒng)計(jì)排錯(cuò)來(lái)說(shuō)很是有利的。本文總結(jié)了nginx日志相關(guān)的設(shè)置如access_log、log_format、open_log_file_cache、log_not_found、log_subrequest、rewrite_log、error_log。
nginx有一個(gè)很是機(jī)動(dòng)的日志記錄模式。每個(gè)級(jí)此外設(shè)置可以有各自獨(dú)立的會(huì)見(jiàn)日志。日志名目通過(guò)log_format呼吁來(lái)界說(shuō)。ngx_http_log_module是用來(lái)界說(shuō)請(qǐng)求日志名目標(biāo)。

1. access_log指令

語(yǔ)法: access_log path [format [buffer=size [flush=time]]];
access_log path format gzip[=level] [buffer=size] [flush=time];
access_log syslog:server=address[,parameter=value] [format];
access_log off;
默認(rèn)值: access_log logs/access.log combined;
設(shè)置段: http, server, location, if in location, limit_except
gzip壓縮品級(jí)。
buffer配置內(nèi)存緩存區(qū)巨細(xì)。
flush生存在緩存區(qū)中的最長(zhǎng)時(shí)間。
不記錄日志:access_log off;
利用默認(rèn)combined名目記錄日志:access_log logs/access.log 或 access_log logs/access.log combined;

2. log_format指令

語(yǔ)法: log_format name string …;
默認(rèn)值: log_format combined “…”;
設(shè)置段: http

name暗示名目名稱(chēng),string暗示等義的名目。log_format有一個(gè)默認(rèn)的無(wú)需配置的combined日志名目,相當(dāng)于apache的combined日志名目,如下所示:


log_format  combined  '$remote_addr - $remote_user  [$time_local]  '
                                   ' "$request"  $status  $body_bytes_sent  '
                                   ' "$http_referer"  "$http_user_agent" ';

假如nginx位于負(fù)載平衡器,新加坡電信服務(wù)器 馬來(lái)西亞服務(wù)器,squid,nginx反向署理之后,web處事器無(wú)法直接獲取到客戶(hù)端真實(shí)的IP地點(diǎn)了。 $remote_addr獲取反向署理的IP地點(diǎn)。反向署理處事器在轉(zhuǎn)發(fā)請(qǐng)求的http頭信息中,可以增加X(jué)-Forwarded-For信息,用來(lái)記錄 客戶(hù)端IP地點(diǎn)和客戶(hù)端請(qǐng)求的處事器地點(diǎn)。PS: 獲取用戶(hù)真實(shí)IP 拜見(jiàn)http://www.ttlsa.com/html/2235.html如下所示:


log_format  porxy  '$http_x_forwarded_for - $remote_user  [$time_local]  '
                             ' "$request"  $status $body_bytes_sent '
                             ' "$http_referer"  "$http_user_agent" ';

日志名目答允包括的變量注釋如下:


$remote_addr, $http_x_forwarded_for 記錄客戶(hù)端IP地點(diǎn)
$remote_user 記錄客戶(hù)端用戶(hù)名稱(chēng)
$request 記錄請(qǐng)求的URL和HTTP協(xié)議
$status 記錄請(qǐng)求狀態(tài)
$body_bytes_sent 發(fā)送給客戶(hù)端的字節(jié)數(shù),不包羅響應(yīng)頭的巨細(xì); 該變量與Apache模塊mod_log_config里的“%B”參數(shù)兼容。
$bytes_sent 發(fā)送給客戶(hù)端的總字節(jié)數(shù)。
$connection 毗連的序列號(hào)。
$connection_requests 當(dāng)前通過(guò)一個(gè)毗連得到的請(qǐng)求數(shù)量。
$msec 日志寫(xiě)入時(shí)間。單元為秒,精度是毫秒。
$pipe 假如請(qǐng)求是通過(guò)HTTP流水線(pipelined)發(fā)送,pipe值為“p”,不然為“.”。
$http_referer 記錄從哪個(gè)頁(yè)面鏈接會(huì)見(jiàn)過(guò)來(lái)的
$http_user_agent 記錄客戶(hù)端欣賞器相關(guān)信息
$request_length 請(qǐng)求的長(zhǎng)度(包羅請(qǐng)求行,請(qǐng)求頭和請(qǐng)求正文)。
$request_time 請(qǐng)求處理懲罰時(shí)間,單元為秒,精度毫秒; 從讀入客戶(hù)端的第一個(gè)字節(jié)開(kāi)始,直到把最后一個(gè)字符發(fā)送給客戶(hù)端后舉辦日志寫(xiě)入為止。
$time_iso8601 ISO8601尺度名目下的當(dāng)?shù)貢r(shí)間。
$time_local 通用日志名目下的當(dāng)?shù)貢r(shí)間。

[warning]發(fā)送給客戶(hù)端的響應(yīng)頭擁有“sent_http_”前綴。 好比$sent_http_content_range。[/warning]

實(shí)譬喻下:


http {
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                                        '"$status" $body_bytes_sent "$http_referer" '
                                        '"$http_user_agent" "$http_x_forwarded_for" '
                                        '"$gzip_ratio" $request_time $bytes_sent $request_length';

        log_format srcache_log '$remote_addr - $remote_user [$time_local] "$request" '
                                '"$status" $body_bytes_sent $request_time $bytes_sent $request_length '
                                '[$upstream_response_time] [$srcache_fetch_status] [$srcache_store_status] [$srcache_expire]';

        open_log_file_cache max=1000 inactive=60s;

        server {
                server_name ~^(www.)?(.+)$;
                access_log logs/$2-access.log main;
                error_log logs/$2-error.log;

                location /srcache {
                        access_log logs/access-srcache.log srcache_log;
                }
        }
}

3. open_log_file_cache指令
騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國(guó)外vps服務(wù)器租用 夢(mèng)飛云服務(wù)器租用 版權(quán)所有 ? 粵ICP備11019662號(hào)

主站蜘蛛池模板: 林州市| 黄浦区| 盐边县| 华亭县| 桓台县| 裕民县| 汕头市| 新邵县| 韶山市| 阿巴嘎旗| 佳木斯市| 保德县| 山丹县| 长岛县| 长治市| 阿拉善右旗| 蒲城县| 河曲县| 新蔡县| 盐边县| 吉木萨尔县| 铜山县| 扎兰屯市| 威海市| 尉氏县| 察隅县| 隆子县| 延长县| 保山市| 蕲春县| 绥宁县| 闵行区| 和龙市| 鸡西市| 怀安县| 泌阳县| 阳城县| 永城市| 博野县| 宜都市| 宁晋县|