worker_processes auto;
worker_rlimit_nofile 65535;

events {
    worker_connections 1024;
    multi_accept on;
}
error_log  /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

http {
    log_format timings '$remote_addr - $remote_user [$time_local] '
                     '"$request" $status $body_bytes_sent '
                     '"$http_referer" "$http_user_agent" '
                     '$request_time $upstream_response_time';

    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    charset                       utf-8;
    sendfile                      on;
    tcp_nopush                    on;
    tcp_nodelay                   on;
    server_tokens                 off;
    keepalive_timeout             65;
    types_hash_max_size           2048;
    types_hash_bucket_size        64;
    server_names_hash_bucket_size 512;
    client_body_buffer_size       128k;
    open_file_cache               max=100000 inactive=20s;
    open_file_cache_valid         45s;
    open_file_cache_min_uses      2;
    open_file_cache_errors        on;
    proxy_read_timeout            60s;
    proxy_send_timeout            60s;
    proxy_connect_timeout         60s;
    large_client_header_buffers 4 64k;
    client_max_body_size          128M;

    client_header_timeout 600s;
    client_body_timeout 600s;
    fastcgi_connect_timeout 200;
    fastcgi_send_timeout 200;
    fastcgi_read_timeout 200;

    # Gzip
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/wasm application/octet-stream;

    # SSL
    ssl_session_timeout    1d;
    ssl_session_cache      shared:SSL:10m;
    ssl_session_tickets    off;

    # Mozilla Modern configuration
    ssl_protocols          TLSv1.2 TLSv1.3;
    proxy_ssl_protocols    TLSv1.1 TLSv1.2 TLSv1.3;

    # OCSP Stapling
    ssl_stapling           on;
    ssl_stapling_verify    on;
    resolver               1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 valid=60s;
    resolver_timeout       2s;
    include /etc/nginx/conf.d/*.conf;
}