user nginx;
worker_processes 16;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
    worker_connections 10240;
    use epoll;
    multi_accept on;
}
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    log_format upstream_time '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" rt=$request_time uct=$upstream_connect_time uht=$upstream_header_time urt=$upstream_response_time "$http_user_agent"';

    log_format json escape=json '{'
    '"time":"$time_iso8601",'
    '"proxy_protocol_addr":"$proxy_protocol_addr",'
    '"remote_addr":"$remote_addr",'
    '"x-forward-for":"$proxy_add_x_forwarded_for",'
    '"request_id":"$request_id",'
    '"request":"$request",'
    '"remote_user":"$remote_user",'
    '"bytes_sent":"$bytes_sent",'
    '"body_bytes_sent":"$body_bytes_sent",'
    '"request_time":"$request_time",'
    '"status":"$status",'
    '"vhost":"$host",'
    '"request_proto":"$server_protocol",'
    '"path":"$uri",'
    '"request_query":"$args",'
    '"request_length":"$request_length",'
    '"method":"$request_method",'
    '"http_referrer":"$http_referer",'
    '"http_user_agent":"$http_user_agent",'
    '"upstream_addr":"$upstream_addr",'
    '"upstream_latency":"$upstream_response_time",'
    '"upstream_status":"$upstream_status",'
    '"upstream_response_time":"$upstream_response_time",'
    '"upstream_connect_time":"$upstream_connect_time",'
    '"upstream_header_time":"$upstream_header_time",'
    '"upstream_bytes_received":"$upstream_bytes_received",'
    '"upstream_bytes_sent":"$upstream_bytes_sent",'
    '"tls":"$ssl_protocol/$ssl_cipher"'
    '}';

    access_log /var/log/nginx/access.log json;

    server_tokens off;
    charset UTF-8;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_requests 1000;
    keepalive_timeout 65;
    #gzip  on;
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    resolver 127.0.0.11 ipv6=off valid=1s;
    include /etc/nginx/conf.d/*.conf;
}