user  root;
worker_processes  4;

pid        log/nginx.pid;
error_log   log/nginx-error.log;
pcre_jit    on;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '"$http_org" "$http_user" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$request_time" "$upstream_response_time" "$pipe"';

    access_log  log/nginx-access.log  main;

    #rate limit
    limit_req_zone $binary_remote_addr zone=perip:10m rate=20r/m;
    limit_req_status 429;

    #tcp_nopush     on;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
	server_names_hash_bucket_size 64;

    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 600;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 16 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;
    client_header_buffer_size 256k;
    large_client_header_buffers 4 256k;
    client_max_body_size 1g;

    uwsgi_connect_timeout 60;
    uwsgi_send_timeout 300;
    uwsgi_read_timeout 600;
    uwsgi_buffer_size 64k;
    uwsgi_buffers 16 64k;
    uwsgi_busy_buffers_size 128k;
    uwsgi_temp_file_write_size 128k;


    #keepalive_timeout  0;
    #keepalive_timeout  65;

    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_types text/plain application/javascript text/css application/json;
    gzip_vary on;
    
    include conf.d/*.conf;
}
