美文网首页
Nginx日志配置

Nginx日志配置

作者: 测试探索 | 来源:发表于2020-06-08 08:18 被阅读0次
Nginx⽇日志配置规范
//配置语法: 包括: error.log   access.log 
Syntax: log_format  name    [escape=default|json]   string  ...; 
Default:    log_format  combined    "...";
 Context:http

//Nginx默认配置 
log_format   main  '$remote_addr - $remote_user [$time_local] "$request"    '                                                                            
                   '$status $body_bytes_sent "$http_referer"    '                                                                        
                   '"$http_user_agent"  "$http_x_forwarded_for"';
//Nginx⽇日志变量量
 $remote_addr               //表示客户端地址
 $remote_user               //http客户端请求nginx认证用户名 
 $time_local                //Nginx的时间 
 $request                  //Request请求行,    GET等⽅方法、http协议版本 
 $status                   //respoence返回状态码 
 $body_bytes_sent          //从服务端响应给客户端body信息大小 
 $http_referer            //http上一级⻚面,  防盗链、用户行为分析 
 $http_user_agent               //http头部信息, 客户端访问设备 
 $http_x_forwarded_for          //http请求携带的http信息

相关文章

网友评论

      本文标题:Nginx日志配置

      本文链接:https://www.haomeiwen.com/subject/uxgktktx.html