nginx檢視轉發日誌(如何檢視nginx的日誌)
nginx的log日誌分為access log 和 error log
其中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訪問日誌在哪裡的詳細內容,更多請關注其它相關文章!
更多技巧請《轉發 關注》哦!