JAVA和Nginx 教程大全

网站首页 > 精选教程 正文

nginx访问日志在哪里

wys521 2024-09-12 23:25:40 精选教程 29 ℃ 0 评论

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访问日志在哪里的详细内容,更多请关注其它相关文章!

更多技巧请《转发 + 关注》哦!

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表