user  root;
worker_processes  4;
worker_rlimit_nofile 102400;
#error_log logs/error.log debug;

events {
	worker_connections  102400;
}

http {
	include       mime.types;
	default_type  application/octet-stream;

	access_log  off;
	#sendfile        off;
	
	keepalive_timeout  300;
	keepalive_requests 1000000;

	proxy_connect_timeout 300;
	#proxy_send_timeout 300;
	#proxy_read_timeout 300;
	#lingering_timeout 3;
	large_client_header_buffers 4 512k;
	client_max_body_size 3000m;
	client_header_buffer_size 2048m;
	client_body_buffer_size 1024m; 
	#open_file_cache max=102400 inactive=20s;
	proxy_buffers  16 10240k;
	proxy_buffer_size 10240k;

	gzip on;

	upstream bk{
		#server 30.40.0.100:8081;
		server 172.30.4.100:8081;
		keepalive 30000;
	}
	upstream bk1{
		#server 30.40.0.100:8082;
		server 172.30.4.100:8082;
		keepalive 30000;
	}
	upstream bk2{
		#server 30.40.0.100:8083;
		server 172.30.4.100:8083;
		keepalive 30000;
	}

	server {
		listen       80;
		#server_name  localhost;
		server_name  172.30.4.23;
		
		server_tokens off;

		proxy_redirect off;
		#proxy_set_header Connection "";
		#proxy_http_version   1.1;
		#chunked_transfer_encoding on;

		location / {
			root   html;
			index  index.html index.htm;
			proxy_pass http://bk;     
			proxy_set_header Connection "";
			proxy_set_header X-Original-URI $request_uri;
			proxy_set_header Host $host:$server_port;       
			chunked_transfer_encoding on;         
			proxy_http_version   1.1;
			mirror /mimic1;
			mirror /mimic2;                                 
			mirror_request_body on;
		}
		location /mimic1{           
			proxy_pass http://bk1$request_uri;
			proxy_set_header X-Original-URI $request_uri;
			proxy_set_header Connection "";
			chunked_transfer_encoding on;
			proxy_http_version   1.1;
			proxy_set_header Host $host:$server_port;            
		}
		location /mimic2{   
			proxy_pass http://bk2$request_uri;        
			proxy_set_header X-Original-URI $request_uri;
			proxy_set_header Host $host:$server_port;
			proxy_set_header Connection "";
			proxy_http_version   1.1;
			chunked_transfer_encoding on;
		}

		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
		root   html;           
		}
	}
}
