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