Commit ebc5cd31 authored by Kunkka王辉's avatar Kunkka王辉 😲

nginx日志格式

parent 9116d7cb
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
if [ ! -d /etc/nginx/php ]; then if [ ! -d /etc/nginx/php ]; then
mkdir /etc/nginx/php mkdir /etc/nginx/php
fi fi
# 超时设置
cat <<EOF >/etc/nginx/conf.d/timeout.conf cat <<EOF >/etc/nginx/conf.d/timeout.conf
client_header_timeout 120s; client_header_timeout 120s;
...@@ -14,6 +16,27 @@ cat <<EOF >/etc/nginx/conf.d/timeout.conf ...@@ -14,6 +16,27 @@ cat <<EOF >/etc/nginx/conf.d/timeout.conf
proxy_read_timeout 120s; proxy_read_timeout 120s;
fastcgi_read_timeout 120s; fastcgi_read_timeout 120s;
EOF EOF
# 日志设置
cat <<EOF >/etc/nginx/conf.d/logs.conf
#Log in JSON Format
log_format nginxlog_json escape=json '{ "timestamp": "\$time_iso8601", '
'"remote_addr": "\$remote_addr", '
'"body_bytes_sent": \$body_bytes_sent, '
'"request_time": \$request_time, '
'"response_status": \$status, '
'"request": "\$request", '
'"request_method": "\$request_method", '
'"host": "\$host",'
'"upstream_addr": "\$upstream_addr",'
'"http_x_forwarded_for": "\$http_x_forwarded_for",'
'"http_referrer": "\$http_referer", '
'"http_user_agent": "\$http_user_agent", '
'"http_version": "\$server_protocol", '
'"nginx_access": true }';
access_log /dev/stdout nginxlog_json;
EOF
cat <<EOF >/etc/nginx/php/$PHP74_HOST.conf cat <<EOF >/etc/nginx/php/$PHP74_HOST.conf
location ~ \.php$ { location ~ \.php$ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment