nginx访问日志在哪里

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使用教程栏目进行学习! 

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享