nginx.conf 8.5 KB
user  www www;
 
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
 
pid /Data/local/nginx-1.8.0/logs/nginx.pid;
# [ debug | info | notice | warn | error | crit ]
error_log  /Data/logs/nginx/nginx_error.log;
#error_log  /dev/null;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
 
events
{
       use epoll;
 
       #maxclient = worker_processes * worker_connections / cpu_number
       worker_connections 51200;
}
 
http
{
       include       /Data/local/nginx-1.8.0/conf/mime.types;
       default_type  application/octet-stream;
       #charset  gb2312,utf-8;
       charset utf-8;

       log_format fenxi '$remote_addr|$http_x_forwarded_for|[$time_local]|$http_host|$request|'
                        '$status|$body_bytes_sent|$request_time|$upstream_response_time|$upstream_cache_status|$http_referer|'
                        '$upstream_addr|$http_user_agent';

       #log_format  main  '$remote_addr - $remote_user [$time_local] $request $request_body '
       #                  '"$status" $body_bytes_sent "$http_referer" '
       #                  '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
 
       # access_log  /log/access.log  main;
       #access_log  /Data/logs/access_yohoshow.com.log main;
 
       #error_page 502 =200 /.busy.jpg;
        #error_page 403 = http://www.yohoboys.com;
        #error_page 404 = http://www.yohoboys.com;
       #General Options
       server_names_hash_bucket_size 128;
       client_header_buffer_size 32k;
       large_client_header_buffers 4 32k;
       client_body_buffer_size    8m; #256k 
       #
       #server_tokens off;
       ignore_invalid_headers   on;
       recursive_error_pages    on;
       server_name_in_redirect off;
      
       sendfile                 on;
 
       #timeouts
       keepalive_timeout 60;
       #test
       #client_body_timeout   3m;
       #client_header_timeout 3m;
       #send_timeout          3m;

      
       #TCP Options 
       tcp_nopush  on;
       tcp_nodelay on;

       #fastcgi options 
       fastcgi_connect_timeout 300;
       fastcgi_send_timeout 300;
       fastcgi_read_timeout 300;
       fastcgi_buffer_size 64k;
       fastcgi_buffers 4 64k;
       fastcgi_busy_buffers_size 128k;
       fastcgi_temp_file_write_size 128k;

#       set_real_ip_from  10.159.191.0/24;
#       real_ip_header X-Forwarded-For;

       #hiden php version
       fastcgi_hide_header X-Powered-By;
    
       #size limits
       client_max_body_size       50m;

       gzip on;
       gzip_min_length  1k;
       gzip_buffers     4 16k;
       gzip_http_version 1.0;
       gzip_comp_level 2;
       gzip_types       text/plain application/x-javascript text/css application/xml;
       gzip_vary on; 
       
        #proxy_temp_path            /dev/shm/proxy_temp;
        proxy_temp_path            /Data/local/nginx-1.8.0/ngx_temp_dir;
        proxy_cache_path /Data/local/nginx-1.8.0/ngx_cache levels=1:2 keys_zone=cache_one:500m inactive=1d max_size=10g;
        proxy_connect_timeout    10;
        proxy_read_timeout       60;
        proxy_send_timeout       10;
        proxy_buffer_size        16k;
        proxy_buffers            4 64k;
        proxy_busy_buffers_size 128k;
        proxy_temp_file_write_size 128k;

        fastcgi_temp_path          /dev/shm/fastcgi_temp;
        client_body_temp_path      /dev/shm/client_body_temp; 

       #upstream web
       upstream mapi {
       server   172.31.55.18:80 weight=6 max_fails=2 fail_timeout=5s;
       server   172.31.55.207:80 weight=3 max_fails=2 fail_timeout=5s;
      }


       upstream yohobuy {
           # ip_hash;
	server   172.31.23.111:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.31.146:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.16.147:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.21.139:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.25.17:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.22.1:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.20.56:8080 weight=6 max_fails=2 fail_timeout=5s;
	}

       upstream yohobuy-pc {
           # ip_hash;
	server   172.31.23.111:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.31.146:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.16.147:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.21.139:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.25.17:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.22.1:8080 weight=6 max_fails=2 fail_timeout=5s;
        server   172.31.20.56:8080 weight=6 max_fails=2 fail_timeout=5s;
	}

       upstream yohobuy-old-www {
           # ip_hash;
           #server   119.254.81.247:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.152:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.161:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.162:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.17:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.201:80 weight=6 max_fails=2 fail_timeout=5s;
            server   172.31.55.70:80 weight=3 max_fails=2 fail_timeout=5s;
            server   172.31.55.71:80 weight=3 max_fails=2 fail_timeout=5s;
            server   172.31.55.62:80 weight=6 max_fails=2 fail_timeout=5s;
	}

#       upstream yohobuy-www-abtest {
#           # ip_hash;
#           #server   119.254.81.247:80 weight=6 max_fails=2 fail_timeout=5s;
#           #server   192.168.100.152:80 weight=6 max_fails=2 fail_timeout=5s;
#           #server   192.168.100.161:80 weight=6 max_fails=2 fail_timeout=5s;
#           #server   192.168.100.162:80 weight=6 max_fails=2 fail_timeout=5s;
#           #server   192.168.100.17:80 weight=6 max_fails=2 fail_timeout=5s;
#           #server   192.168.100.201:80 weight=6 max_fails=2 fail_timeout=5s;
#      
#     	server   172.31.23.111:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.31.146:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.16.147:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.21.139:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.25.17:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.22.1:8080 weight=6 max_fails=2 fail_timeout=5s;
#        server   172.31.20.56:8080 weight=6 max_fails=2 fail_timeout=5s;
#	}

#       upstream yohobuy-old-new {
#           # ip_hash;
#           #server   113.207.76.112:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   123.57.37.213:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   123.57.191.223:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   123.57.189.248:80 weight=6 max_fails=2 fail_timeout=30s;
#	}

#        upstream yohobuy-old-product {
#           # ip_hash;
#           server   192.168.100.7:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.123:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   192.168.100.124:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   192.168.100.21:80 weight=6 max_fails=2 fail_timeout=30s;
#        }

       upstream yohobuy-old-huodong {
           # ip_hash;
#           server  192.168.100.7:80 weight=6 max_fails=2 fail_timeout=5s;
#           server   192.168.100.21:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   192.168.100.123:80 weight=6 max_fails=2 fail_timeout=30s;
#           server   192.168.100.124:80 weight=6 max_fails=2 fail_timeout=30s;
            server   172.31.55.207:80 weight=3 max_fails=2 fail_timeout=5s;
            server   172.31.55.18:80 weight=6 max_fails=2 fail_timeout=5s;
       }

     upstream yoho_service {
	server service.yoho.cn;
	}
 
     upstream unionapi{
       server 172.31.16.99:8088;
      }

       #upstream
       fastcgi_next_upstream error timeout invalid_header http_500;

       #limit_zone   limit  $binary_remote_addr  1m;
       limit_req_zone $binary_remote_addr zone=one:50m rate=20r/s;
       limit_req_zone $binary_remote_addr zone=new:30m rate=50r/s;
       limit_req_zone $binary_remote_addr zone=hibox:10m rate=20r/s;

       #fastcgi cache
       #fastcgi_cache_path /nginxcache levels=1:2 keys_zone=two:10m inactive=1d max_size=3000m;
       #for example just for study! have fun!
       include          vhosts/yohobuy.conf;
       include          vhosts/yohobuy_pc.conf;
       include          vhosts/login.m.yohobuy.com.conf;
}