worker_processes 2; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format aka_logs '{"@timestamp":"$time_iso8601",' '"host":"$hostname",' '"server_ip":"$server_addr",' '"client_ip":"$remote_addr",' '"xff":"$http_x_forwarded_for",' '"domain":"$host",' '"url":"$uri",' '"referer":"$http_referer",' '"upstreamtime":"$upstream_response_time",' '"responsetime":"$request_time",' '"request_method":"$request_method",' '"status":"$status",' '"size":"$body_bytes_sent",' '"request_length":"$request_length",' '"protocol":"$server_protocol",' '"upstreamhost":"$upstream_addr",' '"file_dir":"$request_filename",' '"http_user_agent":"$http_user_agent"' '}'; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root /usr/app/nginx/html/; index index.html index.htm; try_files $uri $uri/ /index.html; }标签:index,http,切割,request,server,Nginx,html,日志,log From: https://www.cnblogs.com/hm1825/p/17687189.html
if ($time_iso8601 ~ "(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}:\d{2}") { set $year $1; set $month $2; set $day $3; } access_log /usr/log/nginx/access-$year$month${day}.log aka_logs; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }