user  http;
worker_processes  auto;
worker_rlimit_nofile 100000;
#worker_cpu_affinity 1000 0100 0010 0001;
#worker_cpu_affinity 1000 0100;
#error_log  logs/error.log error;
#pid        logs/nginx.pid;

error_log  /home/http/FCGI_ADSERVER/Install/nginx/logs/error.log error;
pid /run/nginx.pid;

events {
        worker_connections 1024;
        use epoll;
}


http {
        include       mime.types;
        ignore_invalid_headers on;
        access_log off;
        server_tokens       off;
        keepalive_timeout  65;
        keepalive_requests  2147483647;
        default_type text/plain;
        proxy_http_version 1.1;
        # Look for client IP address in the X-Client-IP header

 #      proxy_buffering  off;
        add_header P3P 'CP="NOI DSP COR LAW CUR ADMo DEVo TAIo PSAo PSDo IVAo IVDo HISo OTPo OUR SAMo BUS UNI COM NAV INT DEM CNT STA PRE LOC"';
        add_header Cache-Control "no-store, no-cache, private";
        #client_max_body_size 2M;
        charset UTF-8;
        #proxy_set_header        X-Real-IP       $remote_addr;
        gzip on;
        gzip_min_length 256;
        gzip_comp_level 3;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
        gzip_buffers 16 8k;
        #gzip_disable "MSIE [1-6].(?!.*SV1)";




        server {
                underscores_in_headers  on;
                listen       80;
                listen       443;
                server_name  127.0.0.1;
                root   /home/http/FCGI_ADSERVER/Install/nginx/htdocs;
                error_page   404  =  /missing.html;
                error_page   500  =  /missing.html;
                error_page   503  =  /missing.html;
                large_client_header_buffers 4  20k;
                real_ip_header $http_remote_addr;

                # Set all sources as trusted.
                 # The real IP module will only be used when the remote IP address is among the trusted.
                set_real_ip_from 0.0.0.0/0;

                location /{
                        index  index.html index.htm;
                }

                location ~* \.(?:js) {
                expires 2d;
                add_header Cache-Control public;
                }
                location /nginx_status {
                         stub_status on;
                         access_log off;
                }

                location /AdServer/AdServerServlet {
                        include       fastcgi.conf;
                        include       fastcgi_params;
                        fastcgi_pass  unix:/home/http/FCGI_ADSERVER/Install/nginx/adserver_nginx.socket;
                        fastcgi_param SCRIPT_FILENAME  /usr/local/nginx/$fastcgi_script_name;
                        fastcgi_param QUERY_STRING     $query_string;
                        expires off;
                }
        }
}
