####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;
大概是server_name过长引起的
####===========================补充=========================== ####Nginx中if如何写? Nginx中有严格的语法检查,注意下面 "if" 和 "("之间的空格
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;
}
来源:oschina
链接:https://my.oschina.net/u/2374253/blog/700578