user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      'upstream_addr=$upstream_addr upstream_status=$upstream_status '
                      'request_time=$request_time urt=$upstream_response_time '
                      'uct=$upstream_connect_time uht=$upstream_header_time';

    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;

    server_tokens off;
    
    # Sets the maximum allowed size of the client request body. 
    client_max_body_size 130M;

    # Sets a timeout during which a keep-alive client connection will stay open on the server side. 
    # The zero value disables keep-alive client connections.
    keepalive_timeout   4000;
    types_hash_max_size 4096;
    proxy_read_timeout  4000;
    proxy_connect_timeout 4000;
    proxy_send_timeout 4000;

    # Defines a timeout for reading client request header. 
    # If a client does not transmit the entire header within this time, the request is terminated with the 408 (Request Time-out) error.
    client_header_timeout 4000;
    server_names_hash_bucket_size 256;
    
    # Defines a timeout for reading client request body. 
    # The timeout is set only for a period between two successive read operations, not for the transmission of the whole request body.
    # If a client does not transmit anything within this time, the request is terminated with the 408 (Request Time-out) error.
    client_body_timeout 4000;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d/tenantID-envType/ directory.
    include /etc/nginx/conf.d/*/*.conf;

    upstream upstream_balancer {
                server 0.0.0.1; # placeholder
                keepalive 256;
                keepalive_timeout  4000s;
                # Sets the maximum number of requests that can be served through one keep-alive connection.
                # After the maximum number of requests are made, the connection is closed.
                keepalive_requests 100;
        }

    server {
        listen       8080;
        server_name  _;
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}
