This commit is contained in:
parent
e3097d3e05
commit
736c25f740
|
|
@ -0,0 +1,31 @@
|
|||
# 定义日志格式
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||
'$request_time $upstream_response_time';
|
||||
|
||||
log_format json_combined escape=json '{'
|
||||
'"timestamp":"$time_iso8601",'
|
||||
'"remote_addr":"$remote_addr",'
|
||||
'"remote_user":"$remote_user",'
|
||||
'"request":"$request",'
|
||||
'"status": "$status",'
|
||||
'"body_bytes_sent":"$body_bytes_sent",'
|
||||
'"http_referer":"$http_referer",'
|
||||
'"http_user_agent":"$http_user_agent",'
|
||||
'"http_x_forwarded_for":"$http_x_forwarded_for",'
|
||||
'"request_time":"$request_time",'
|
||||
'"upstream_response_time":"$upstream_response_time"'
|
||||
'}';
|
||||
|
||||
# 访问日志配置
|
||||
access_log /var/log/nginx/access.log main buffer=32k flush=5s;
|
||||
access_log /var/log/nginx/access.json.log json_combined buffer=32k flush=5s;
|
||||
|
||||
# 错误日志配置
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# 开启压缩日志功能
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
|
||||
Loading…
Reference in New Issue