#user  nobody;
worker_processes  2;
worker_cpu_affinity 0001 0010;

error_log  /data/logs/nginx/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

worker_rlimit_nofile 65535;

events {
    use epoll;
    worker_connections  65535;
}
# 端口代理
#stream {
#    #qdkj_mysql
#    upstream qdkj_mysql {
#        hash $remote_addr consistent;
#        server 10.100.0.3:3306 weight=1 max_fails=3 fail_timeout=30s;
#    }
#    server {
#        #监听端口
#        listen 6033; 
#        proxy_connect_timeout 30s;
#        proxy_timeout 600s;
#        proxy_pass qdkj_mysql;
#    }
#}

http {
    include       /usr/local/nginx/conf/mime.types;
    default_type  application/octet-stream;
    ## Log Options
    #log_format   main '[$time_local] $status $remote_addr "$request" "$request_body" "$http_referer" $body_bytes_sent $request_time $upstream_response_time';
    log_format main '$remote_addr - "$remote_user$request_body" [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $connection $upstream_addr $upstream_response_time $request_time';
    #access_log  logs/access.log  main;
    access_log off;

    ## Size Limits
    server_names_hash_bucket_size 128;
    client_header_buffer_size   128k;
    client_body_buffer_size     512k;
    client_max_body_size        300m;
    large_client_header_buffers 4 128k;

    ## Timeouts
    client_body_timeout         1m;
    client_header_timeout       1m;
    keepalive_timeout           65s;
    send_timeout                60s;

    ## General Options
    charset       utf-8;
    ignore_invalid_headers      on;
    keepalive_requests          100;
    limit_conn_zone            $binary_remote_addr zone=perip:5m;
    recursive_error_pages       on;
    sendfile                    on;
    server_name_in_redirect     on;
    server_tokens               off;

    ## TCP Options
    tcp_nopush     on;
    tcp_nodelay    on;

    ## Compression
    gzip                on;
    #gzip_static        on;
    gzip_min_length     1k;
    gzip_buffers        16 8k;
    gzip_http_version   1.1;
    gzip_comp_level     9;
    gzip_types          text/plain application/x-javascript text/css application/xml application/json;
    gzip_vary           on;

    ## Proxy Options
    proxy_connect_timeout       60s;
    proxy_read_timeout          1m;#300;
    proxy_send_timeout          1m;#600;

    proxy_buffering             off;
    proxy_buffers              32 32k;
    proxy_buffer_size          64k;
    proxy_busy_buffers_size    128k;
    #proxy_temp_file_write_size 128k;
    #proxy_temp_path  temp/proxy_temp_dir;
    proxy_cache_path  /data/logs/nginx/proxy_cache_dir  levels=1:2   keys_zone=cache_one:200m inactive=1d max_size=1g;

    proxy_set_header Host  $host;
    proxy_set_header X-Forwarded-For  $remote_addr;


    #load other config
    include /data/setupfiles/nginx/conf/*.conf;
}