api.yoho.cn.conf 5.49 KB
server {

    listen    80  default_server backlog=8192;

    ## for proxy
    proxy_http_version 1.1;
    proxy_set_header Connection ""; 
    
	
    server_name  api.yoho.cn  api.yoho.yohoops.org  apigray.yoho.cn   eshop.yoho.cn   service.yoho.cn service.yoho.yohoops.org   api-dc1-qq.yoho.cn api-dc1-ali.yoho.cn api-dc2-qq.yoho.cn api-dc2-ali.yoho.cn;

    
    access_log  /Data/logs/nginx/api.yoho.cn_access.log  fenxi;
    error_log   /Data/logs/nginx/api.yoho.cn_error.log;

	
    set $real_ip "";
    set_by_lua_file $real_ip conf/setup.lua;
	
    access_by_lua_file  'conf/lua/limit_api_flow.lua';
	

#################### reject http HEAD & status check / .ico quest ######### 

	# HEAD REQUEST RETURN 405
    if ( $request_method = HEAD ) {
     	 return 200;
    }
	
	# nginx status check
    location = /status_check {
           default_type text/html;
           return 200  'server is ok!';  
    }
   
    # cdn check 
     location = /test.html {
       return 200;
     }
   
    location  = /favicon.ico {
         log_not_found off;
         access_log off;  
    }
    


#################### begin  match  service.yoho.cn #########################
    
    location /shops/service/v1/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }

    location  /operations/{
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }

    location  /suggest/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }

    
    location  /payment/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
     }

    location  /guang/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }
    
    location  /passport/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }
  
   #smart...
   location  /smart/ {
        set $service_matched 1;
        rewrite_by_lua_file conf/redirect.lua;
    }



    # union 
 location ^~ /union/ {
      proxy_pass  http://union_pools;
      proxy_set_header   X-Real-IP  $real_ip;
      proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header   Accept-Encoding "gzip";
      proxy_http_version  1.1;
      proxy_set_header   Connection "";
      proxy_set_header Host $host;
    }

    # activity #
    location ^~ /activity/ {
        proxy_redirect off;
        proxy_pass http://activityApi/activity/;
        proxy_set_header X-Real-IP $real_ip;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Accept-Encoding "gzip";
        proxy_http_version  1.1;
        proxy_set_header   Connection "";
        proxy_set_header Host $host;
    }
    
    #  wechat #
    location ^~ /wechat/ {
      proxy_redirect off;
      proxy_pass  http://apiWechat/wechat/;
      proxy_set_header   X-Real-IP  $real_ip;
      proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header   Accept-Encoding "gzip";
      proxy_http_version  1.1;
      proxy_set_header   Connection "";
      proxy_set_header Host $host;
    }
    
  
 
    #  ali_pay_old  #
    location ^~ /pay/notice/alimobilenoticemini {
        proxy_redirect off;
        proxy_pass  http://apigateway/gateway/payment/alipay_notify;
        proxy_set_header   X-Real-IP  $real_ip;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Accept-Encoding "gzip";
        proxy_http_version  1.1;
        proxy_set_header   Connection "";
        proxy_set_header Host $host;
    }
    
    # favourite, all request starts with /favourite
   location ^~  /favorite {
                proxy_redirect off;
                proxy_pass  http://brower/brower;
                proxy_set_header   X-Real-IP  $real_ip;
                proxy_set_header   X-Forwarded-For $remote_addr;
                proxy_http_version  1.1;
                proxy_set_header   Connection "";
    }
#################### end  match  service.yoho.cn #########################


#################### begin  match  api.yoho.cn #########################
    
    location / {
        rewrite_by_lua_file conf/redirect.lua;
    }

#################### end  match  api.yoho.cn #########################

   location  /apigateway{
        internal;
        proxy_redirect off;
        proxy_pass  http://apigateway/gateway;
        proxy_set_header   X-Real-IP  $real_ip;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Accept-Encoding "gzip";
        proxy_http_version  1.1;
        proxy_set_header   Connection "";
        proxy_set_header Host $host;
    }

  

    location = /activityApi{
        internal;
        proxy_redirect off;
        proxy_pass  http://activityApi/activity;
        proxy_set_header   X-Real-IP  $real_ip;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Accept-Encoding "gzip";
        proxy_http_version  1.1;
        proxy_set_header   Connection "";
        proxy_set_header Host $host;
    }

    location = /wechatApi{
        internal;
        proxy_redirect off;
        proxy_pass  http://apiWechat/wechat;
        proxy_set_header   X-Real-IP  $real_ip;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   Accept-Encoding "gzip";
        proxy_http_version  1.1;
        proxy_set_header   Connection "";
        proxy_set_header Host $host;
   } 


 location /6894964747.txt {
        root /Data/local/openresty-1.9.15.1/nginx/html;
    }
  
}