user www-data;
worker_processes  1;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
    # multi_accept on;
}
http {
    include       /etc/nginx/mime.types;
    types_hash_max_size 2048;
    server_names_hash_bucket_size 64;
access_log /var/log/nginx/access.log;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;
    gzip  on;
    gzip_min_length  5k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 4;
    gzip_types       text/plain application/x-javascript text/css application/xml application/json text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    
    upstream backend {
        server localhost:3456 ;
        server localhost:4567 ;
        server localhost:5678 ;
        server localhost:6789 ;
    }
    server {
       listen 80;
       server_name api.caiqr.com;
       location /api {
                proxy_set_header Referer "";
                proxy_pass http://backend/api;
                client_max_body_size    10m;
       }
    }
    server {
       #listen 80;
       listen 80 default_server;
       root /data/caiqiu/wapBetting/src;
       index index.html index.htm;
       server_name  localhost;
       location / {
                try_files $uri $uri/ =404;
       }
       location /get_api_post_data/{
                proxy_pass http://127.0.0.1:8888/get_api_post_data;    
       }
       location /fragment_cache {
                proxy_pass http://127.0.0.1:8888/fragment_cache;    
       }
       location /match_data/{
                proxy_pass http://127.0.0.1:8888/match_data;    
       }
       location /match_basketball_data/{
                proxy_pass http://127.0.0.1:8888/match_basketball_data;    
       }
    }
}
原文:http://www.cnblogs.com/zerohu/p/6188216.html