nginx日志配置
log_format main 'remote_addr - remote_user [time_local\] "request" '
'status "http_referer" '
'"http_user_agent" "http_x_forwarded_for" "request_time" "upstream_response_time"';
access_log /home/msspoper/nginx/logs/access.log main;
常用变量:
$status http响应状态,200,404,500等
$request_body http请求体
还有些自定义变量,比如header里代码增加了自定义的请求头,则使用变量名:http_请求头名称可输出该请求头值,比如代码里请求头添加了userId,则使用http_userId就可以拿到请求头的userId值,注意有时nginx不区分大小写,也就是header里使用userId,使用变量$http_userid可以取到header里的值。
如果header的参数名带