nginx 子域名代理
2016-10-13 本文已影响0人
penggy
server {
...
set $subdomain /www;
if ( $host ~* (\b(?!www\b)\w+)\.\w+\.\w+ ) {
set $subdomain /$1;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
if ( $subdomain = "/sd" ) {
proxy_pass http://www.bitmap.cc:8090;
break;
}
root /mnt/html$subdomain;
index index.html index.htm;
}
...
}