nginx.test.yohobuy.conf 1.45 KB
server
{
    listen       80;
    server_name  buy.test.yoho.cn guang.buy.test.yoho.cn;

    #access_log /Data/logs/access.buy.test.yoho.cn.log  combined;
    error_log  /Data/logs/error.buy.test.yoho.cn.log warn;

    root  /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;

    #match ip
    deny 192.168.1.1;
    allow 218.94.75.50;
    allow 218.94.75.58;
    allow 123.56.138.21;
    deny all;

    location ~* \.html$ {
        root  /Data/code/git/yohobuy/assets;
        if (-f $request_filename){
            expires  3m;
        }
    }

    location ~* \.(ico|woff)$ {
        expires    7d;
    }

    location = /crossdomain.xml {
        expires    7d;
    }

    location / {
        proxy_redirect off;
        proxy_pass http://yohobuy;
        proxy_set_header   Host   $host;
        proxy_set_header   X-Real-IP  $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Accept-Encoding "gzip";
    }

}

server
{
     listen       80;
     server_name  static.buy.test.yoho.cn;
      
     #access_log /Data/logs/access.static.buy.test.yoho.cn.log  combined;
     #error_log  /Data/logs/error.static.buy.test.yoho.cn.log warn;
      
     root  /Data/code/git/yohobuy/static;

     location / {
         log_not_found off;
         access_log off;
         expires 30d;
     }

     location ~* \.(svg|eot|ttf|woff|otf)$ {
         add_header Access-Control-Allow-Origin *;
         expires 30d;
     }

}