user root root;
worker_processes 1;
worker_rlimit_nofile 20000;
error_log  /var/log/nginx/error.log  notice;

events {
    use epoll;
    worker_connections 20000;
    multi_accept on;
}

http {
    include mime.types;
    default_type application/octet-stream;
    
    log_format main
	    	 '{"time_iso8601":"$time_iso8601",'
                 '"remote_addr":"$remote_addr",'
                 '"request":"$request",'
                 '"status":$status,'
                 '"request_method": "$request_method",'
                 '"body_bytes_sent":$body_bytes_sent,'
                 '"request_time":$request_time,'
                 '"upstream_response_time":$upstream_response_time,'
                 '"upstream_addr":"$upstream_addr",'
                 '"host":"$host",'
                 '"url":"$uri",'
                 '"http_x_forwarded_for":"$http_x_forwarded_for",'
                 '"http_referer":"$http_referer",'
                 '"http_user_agent":"$http_user_agent"}';

    
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    server_tokens off;
    types_hash_max_size 4096;
    server_names_hash_bucket_size 128;
    
    keepalive_timeout 0;
    client_max_body_size 0;

    gzip on;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml;
    gzip_min_length 1k;
    gzip_comp_level 1;
    gzip_buffers 32 4k;

    map $http_connection $connection_upgrade {
        "~*Upgrade" $http_connection;
        default keep-alive;
    }

    include conf.d/*.conf;
}
