请教nginx location配置问题
nginx吧
全部回复
仅看楼主
level 1
location /api {
fastcgi_pass 127.0.0.1:20011;
fastcgi_pass_header status;
....
}
location ~ \.fcgi$ {
fastcgi_pass 127.0.0.1:20011;
fastcgi_pass_header status;
........
}
配置是这样的,它可以满足192.168.136.91:20000/myfast.fcgi这样的命名(IP不是固定的,随便的Ip都可以,所以不能固定写死);
但是现在想建立一个反向服务器
当接受到这样的命令后:
192.168. 136.91:20000/reverseProxy/192.168.136.92/reverseProxy.fcgi
就是91的服务器接受到这样的命令,转到92上
然后添加了这样的location:
location /reverseProxy {
if ($request_uri ~* ^/reverseProxy/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/(.*)$){
set $node $1;
set $param $2;
}
proxy_set_header Host $host;
proxy_pass$scheme://$node:20000/$param;
}
但是因为
192.168.136.91:20000/myfast.fcgi
192.168. 136.91:20000/reverseProxy/192.168.136.92/reverseProxy.fcgi
这两条url都是以.fcig结束的,所以都走了
location ~ \.fcgi$ {
fastcgi_pass 127.0.0.1:20011;
fastcgi_pass_header status;
........
}
这个配置。
所以我的这个正则表达式该怎么写
2016年03月15日 08点03分 1
level 13
location = /reverseProxy {
提高优先级
2016年03月23日 03点03分 2
1