yohoglobalbs.conf 10.9 KB
server{
    listen       80;
    server_name  admin.global.yohobuy.com;
    access_log /Data/logs/nginx/access_yohobuy_global_bs.log  fenxi;
    
    location = /status_check {
        default_type text/html;
        return 200  'server is ok!';  
    }

    location / {
        allow   218.94.75.50;
        allow   218.94.75.58;
        allow   218.94.77.166;
        allow   106.38.39.122;
        allow   106.38.39.123;
        allow   192.168.0.0/16;
        allow   10.66.0.0/16;
        deny    all;
        proxy_redirect off;
        proxy_pass  http://10.66.5.17:8080;
        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";
    }

    location ~* \.(ico|woff)$ {
        root	/Data/PE/yoho-global-bs/Websites/public;
	    expires    7d;
    }
    location = /crossdomain.xml {
        root	/Data/PE/yoho-global-bs/Websites/public;
        expires    7d;
    }

    error_page   500 502 503 504  /50x.html;
    location = /404.html {
        root   /usr/local/openresty/nginx/html/;
    }
    location = /50x.html {
        root   /usr/local/openresty/nginx/html/;
    }
}

server{
    listen       80;
    server_name  service.api.global.yohobuy.com;
    access_log /Data/logs/nginx/access_yohobuy_global_bs.log  fenxi;


    location / {
        proxy_redirect off;
        proxy_pass  http://globalbs;
        proxy_connect_timeout    300;
        proxy_read_timeout       300;
        proxy_send_timeout       300;
        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";
    }

    location ~* \.(ico|woff)$ {
        root	/Data/PE/yoho-global-bs/Websites/public;
        expires    7d;
    }

    location = /crossdomain.xml {
        root	/Data/PE/yoho-global-bs/Websites/public;
        expires    7d;
    }

    error_page   500 502 503 504  /50x.html;

    location = /404.html {
        root   /usr/local/openresty/nginx/html/;
    }

    location = /50x.html {
        root   /usr/local/openresty/nginx/html/;
    }
}

server{
    listen       80;
    server_name  api-global.yohobuy.com;
    
     if ($request_method !~* GET|POST) {
		    return 200;
	 }
    
    access_log /Data/logs/nginx/access_yohobuy_global_bs.log  fenxi;
     
################## 临时使用,NGINX直接返回模拟的数据###########################

    location = /order/api/v1/cart/getCartGoodList {
        default_type application/json;
        return 200  '{"code":"200","message":"cart list","data":{"global_cart_data":{"shopping_cart_data":{"shopping_key":"0","order_amount":0,"goods_count":0,"selected_goods_count":0,"str_order_amount":"¥0","str_tariff_amount":"¥0.00","tariff_select":"Y","promotion_formula":"总计¥0=商品金额¥0","promotion_formula_list":{"promotion":"商品金额","promotion_amount":"¥0"}},"goods_list":[],"sold_out_goods_list":[]}},"md5":"","t":{"i":0.0012209415435791,"e":0.0046169757843018,"t":0.0058379173278809},"s":"N"}';  
    }

    location = /order/api/v1/cart/getCartGoodCount {
        default_type application/json;
        return 200  '{"code":"200","message":"cart count","data":{"uid":"0","shopping_key":"","cart_goods_count":0},"md5":"","t":{"i":0.001276969909668,"e":0.0031371116638184,"t":0.0044140815734863},"s":"N"}';  
    }

    location = /order/api/v1/detail/getcount {
        default_type application/json;
        return 200  '{"code":"200","message":"order count","data":{"hasOrder":"N","collect_count":0,"successOrder":0,"cancelOrder":0,"tradingOrder":0},"md5":"","t":{"i":0.0010910034179688,"e":0.0036270618438721,"t":0.0047180652618408},"s":"N"}';
    }


   location = /order/api/v1/detail/getlist {
      default_type application/json;
        return 200  '{"code":200,"data":{"total":"0","page_total":0,"page":1,"order_list":[]},"md5":"","message":"操作成功"}';  
    }

    location = /phpproxy/order/api/v1/detail/getlist {
      default_type application/json;
        return 200  '{"code":"200","message":"order list","data":{"order_list":[],"page_total":0,"page":1,"total":"0"},"md5":"","t":{"i":0.0010490417480469,"e":0.030877828598022,"t":0.031926870346069},"s":"N"}';  
    }

    location = /order/api/v1/collect/getCollectList {
      default_type application/json;
        return 200  '{"code":"200","message":"collect product list","data":{"total":0,"page":1,"page_total":0,"product_list":[]},"md5":"","t":{"i":0.0010011196136475,"e":0.0028970241546631,"t":0.0038981437683105},"s":"N"}';  
    }


   location = /order/api/v1/detail/getReasonForCancelOrder {
        default_type application/json;
        return 200  '{"code":"200","message":"order cancel reason list","data":[{"id":1,"reason":"支付不成功"},{"id":2,"reason":"现在不想购买"},{"id":3,"reason":"订单价格有问题"},{"id":4,"reason":"修改订单信息"},{"id":5,"reason":"错误或重复下单"},{"id":6,"reason":"商品价格较贵"},{"id":7,"reason":"运费较高"},{"id":8,"reason":"其他"}],"md5":"","t":{"i":0.0015950202941895,"e":0.00031089782714844,"t":0.0019059181213379},"s":"N"}';
    }

    location / {
        proxy_redirect off;
        proxy_pass  http://globalbs;
        proxy_connect_timeout    300;
        proxy_read_timeout       300;
        proxy_send_timeout       300;
        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";
    }
###########begin java##############
    location ^~ /order/api/v1/address/infoList {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/address/infoList;
        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";
    }

    location ^~ /order/api/v1/address/add {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/address/add;
        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";
    }

    location ^~ /order/api/v1/address/edit {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/address/edit;
        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";
    }
    
    ########change by jian.chen 10/1/2017  yuankai ##################
    location ^~ /product/api/v2/detail/getlist {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/product/api/v2/detail/getlist;
        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";
    }
    #########change by xiu.chun 24/05/2017 yuankai####################
     location ^~ /order/api/v1/confirm/preview {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/confirm/preview;
        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";
    }
      location ^~ /order/api/v1/detail/getlist{
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/detail/getlist;
        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";
    }
    location ^~ /order/api/v1/address/setDefault {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/address/setDefault;
        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";
    }

    location ^~ /order/api/v1/address/delete {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/address/delete;
        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";
    }

    location = /order/api/v1/detail/get {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/detail/get;
        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";
    }

    location ^~ /order/api/v1/detail/editAddress {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/detail/editAddress;
        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";
    }

    location ^~ /order/api/v1/detail/cancel {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/detail/cancel;
        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";
    }

    location ^~ /order/api/v1/detail/del {
        proxy_redirect off;
        proxy_pass  http://globalbuyapi/globalbuy/order/api/v1/detail/del;
        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";
    }
	
	location ~ /phpproxy {
        proxy_pass http://globalbs;
        proxy_set_header   Host   $host;
        proxy_set_header   X-Real-IP  $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    }
############end java###############
    location ~* \.(ico|woff)$ {
        root	/Data/PE/yoho-global-bs/Websites/public;
        expires    7d;
    }

    location = /crossdomain.xml {
         root	/Data/PE/yoho-global-bs/Websites/public;
        expires    7d;
    }

    error_page   500 502 503 504  /50x.html;

    location = /404.html {
        root   /usr/local/openresty/nginx/html;
    }

    location = /50x.html {
        default_type application/json;
        return 200  '{"message": "活动太火爆了,请稍后重试","code": 500}';  
    }   
}