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使用教程欄目進行學習!?
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END