api.ufo.conf 1.62 KB
server {

    listen    80  default_server backlog=8192;

    ## for proxy
    proxy_http_version 1.1;
    proxy_set_header Connection ""; 
    
	
    server_name  2.yohobuy.com;

    
    access_log  /Data/logs/nginx/ufo_access.log  fenxi;
    error_log   /Data/logs/nginx/ufo_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  2.yohobuy.com #########################
    
  #  location / {
   #     rewrite_by_lua_file conf/redirect.lua;
   # }

#################### end  match  2.yohobuy.com #########################

   location  / {
        limit_req zone=limit_ufo burst=2 nodelay;
        proxy_redirect off;
        proxy_pass  http://ufogateway/ufo-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 ~* .(txt)$ {
        root /Data/local/openresty-1.9.15.1/nginx/html;
    }
  
}