Nginx反向代理

####Nginx反向代理-根據二級目錄反向代理 http://www.oschina.net/code/snippet_2374253_57477 ####Nginx反向代理-根據域名反向代理 http://www.oschina.net/code/snippet_2374253_57479 ####記錄一個錯誤 you should increase server_names_hash_bucket_size: 32 ####解決方案 http{}中加入server_names_hash_bucket_size 64;html

大概是server_name過長引發的cookie

####===========================補充=========================== ####Nginx中if如何寫? Nginx中有嚴格的語法檢查,注意下面 "if" 和 "("之間的空格.net

location / {

	set $flag "";
	if ( $host = "pre.xiaoyuan52.com" ) {
		set $flag "http://127.0.0.1:8080/";
	}
	if ( $host = "bsm.xiaoyuan52.com" ) {
		set $flag "http://127.0.0.1:7080/";
	}
	
	proxy_pass         $flag;
	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   Cookie $http_cookie;
	proxy_cookie_path / /;
	
	#root   html;
	#index  index.html index.htm;
}
相關文章
相關標籤/搜索