找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 服务器运维 查看内容

nginx访问日志在哪里

作者:模板之家 2019-7-15 14:00 6251人关注

这要看你如何配置,如使用此命令access_log /usr/local/nginx/log/access.log main;。就将访问日志的储存位置和文件配置完毕。/usr/local/nginx/log/access.log为储存位置。

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访问日志在哪里的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: [db:来源]

全部回复(0)

发表评论