首頁  >  文章  >  運維  >  nginx訪問日誌在哪裡

nginx訪問日誌在哪裡

(*-*)浩
(*-*)浩原創
2019-07-15 14:00:1410909瀏覽

nginx的log日誌分為access log 和error log

nginx訪問日誌在哪裡

#其中access log(訪問日誌)記錄了哪些用戶,哪些頁面以及用戶瀏覽器、ip和其他的存取資訊

access日誌格式配置

 log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"'
                       '$upstream_addr $upstream_response_time $request_time ';
    access_log  logs/access.log  main;

配置access log日誌的儲存位置及檔案。

注意:access.log檔案是可以依日期分割的,方便檢視及處理

access_log /usr/local/nginx/log/access.log main;

##相關說明解釋

$remote_addr 与$http_x_forwarded_for 用以记录客户端的ip地址;
$remote_user :用来记录客户端用户名称;
$time_local : 用来记录访问时间与时区;
$request : 用来记录请求的url与http协议;
$status : 用来记录请求状态;成功是200,
$body_bytes_s ent :记录发送给客户端文件主体内容大小;
$http_referer :用来记录从那个页面链接访问过来的;
$http_user_agent :记录客户端浏览器的相关信息;
更多Nginx相關技術文章,請造訪

Nginx使用教學欄位進行學習! 

以上是nginx訪問日誌在哪裡的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn