user nginx;
worker_processes auto;

error_log off;

pid        /var/run/nginx.pid;

events {
    worker_connections 10240; # increase for busier servers
    use epoll; # you should use epoll here for Linux kernels 2.6.x
    multi_accept on;
    accept_mutex off;
}

worker_rlimit_nofile 65535;
worker_priority -10;

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

        server_tokens off;
        sendfile on;
        sendfile_max_chunk 10240k;
        #aio threads=default;
        directio 64m;  #Serve Large files like media files using directio

        tcp_nopush on;
        tcp_nodelay on;

        proxy_http_version 1.1;
        proxy_set_header Connection "";

        server_name_in_redirect on;
        server_names_hash_max_size 2048;
        server_names_hash_bucket_size 2048;

        # timeouts
        ignore_invalid_headers on;
        client_header_timeout 90;
        client_body_timeout 90;
        send_timeout 90;
        reset_timedout_connection on;
        client_body_in_file_only clean;
        keepalive_requests 1024;
        keepalive_timeout 10s;

        # gzip compression
        gzip on;
        gzip_vary on;
        gzip_disable "MSIE [1-6]\.(?!.*SV1)";
        gzip_proxied any;
        gzip_min_length 1024;
        gzip_http_version 1.1;
        gzip_comp_level 6;
        gzip_buffers 64 8k;
        gzip_types text/plain text/xml image/svg+xml application/rss+xml application/atom+xml application/xhtml+xml text/css application/json text/javascript application/x-javascript application/font-otf application/font-ttf;

        # buffers
        connection_pool_size 256;
        client_body_buffer_size 128K;
        client_header_buffer_size 16k;
        large_client_header_buffers 4 32k;
        request_pool_size 4k;
        output_buffers 4 32k;
        postpone_output 1460;
        client_max_body_size 64M;

        # fastcgi settings
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        # the below options depend on theoretical maximum of your PHP script run-time
        fastcgi_read_timeout 600s;
        fastcgi_send_timeout 600s;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/vhosts.d/*.conf;

}
