nginx日志格式

日志格式 

log_format main '$remote_addr - $remote_user [$time_local] $request '
                    '"$status" $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';



log_format main1 '$proxy_add_x_forwarded_for - $remote_user [$time_local] ' 
                      '"$request" $status $body_bytes_sent '
                      '"$http_referer" "$http_user_agent"';  //此日志格式为,ip不仅记录代理的ip还记录远程客户端真实IP。

 

 

在nginx虚拟主机中分别用main main1 引用即可。

posted @ 2016-07-15 01:21  某电商首席日志工程师  阅读(229)  评论(0编辑  收藏  举报