0
如何将URL匹配的初级讲座与PCRE:如何我一个URL匹配后的变量
http://www.test.com/abc?v=123&feature=True
http://www.test.com/def?v=456&feature=True
我现在要做的就是匹配域名下的路径(abc或def), ,以便我可以使用nginx将请求重定向到指定的主机。
#content of /etc/nginx/sites-enabled/default
location/{
#default redirect
proxy_pass http://www.google.com;
#redirect by domain name.
if ($path ~* abc)
{
proxy_pass http://10.1.1.47:8081?v=123&feature=True;
}
if ($path ~* edf)
{
proxy_pass http://10.1.1.48:8081?v=456&feature=True;
}
}
PS:域和路径不仅限于www.test.com和(abc | def)。
谢谢!
到目前为止你有什么? – LeleDumbo