user                 nginx;
pid                  /var/run/nginx.pid;
worker_processes     auto;
worker_rlimit_nofile 65535;

events {
    multi_accept       on;
    worker_connections 65535;
}

http {
    charset              utf-8;
    sendfile             on;
    tcp_nopush           on;
    tcp_nodelay          on;
    server_tokens        off;
    log_not_found        off;
    types_hash_max_size  2048;
    client_max_body_size 16M;

    # MIME
    include              mime.types;
    default_type         application/octet-stream;

    # Logging
    log_format log_json '{'
                    '"remote_addr": "$remote_addr", '
                    '"ident": "-", '
                    '"user": "$remote_user", '
                    '"timestamp": "$time_local", '
                    '"request": "$request", '
                    '"status": $status, '
                    '"bytes": $body_bytes_sent, '
                    '"referer": "$http_referer", '
                    '"agent": "$http_user_agent", '
                    '"x_forwarded": "$http_x_forwarded_for"'
                    ' }';
    
    access_log           /var/log/nginx/access.log log_json;
    error_log            /var/log/nginx/error.log warn;

    # reverse proxy/server configs
    include              /etc/nginx/conf.d/*.conf;
}

# port forward configs
stream{
    include /etc/nginx/conf.d/stream/*.conf;
}
