1
maga 2014-03-30 10:30:39 +08:00 via iPhone 1
rewrite 写个正则匹配?
|
2
xoxo 2014-03-30 16:05:00 +08:00 2
server{
server_name ~^(?<prefix>.+)\.x\.123\.com$; ... location / { set $hostbase '.y.abc.com'; set $host2proxy $prefix$hostbase ; proxy_pass $host2proxy; .... } } i will be glad if works... |
3
hourui 2014-03-30 16:09:48 +08:00 3
首先 server_name ~^it\.(?<subdomain>[^\.]+)\.123\.com$;
然后 proxy_pass http://it.$subdomain.abc.com/; 大功告成 |
4
xsziran 2014-03-30 23:06:53 +08:00 1
https://code.google.com/p/7ghost/
这个应该可以 不过好像停止开发了 |
6
ysjdx 2014-03-31 10:41:48 +08:00 1
server {
listen [::]:80; server_name *.x.123.com; location / { if ($host ~* ^(.*).x.123.com$) { set $domain $1; proxy_pass http://$domain.y.abc.com; } } } |
10
michelh OP @ysjdx 113.110.xxx.xxx - - [03/Apr/2014:16:03:01 +0800] "GET /favicon.ico HTTP/1.1" 502 568 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
|
12
coolloyal 2014-04-13 22:57:31 +08:00 1
@ysjdx
我这也是这个情况502错误,请问他的问题解决了吗? server { listen 80; server_name ~^(www\.)?(?<domain>.+)\..+$; index index.php index.html index.htm; location / { proxy_pass http://$domain.xxx.com/; } } |