server {
set $hostip 10.1.9.201; //set variable
listen 80;
root /var/www;
server_name ~^(?P<iname>.+).xxx.cn;
index $iname.php;
location ~ \.php {
proxy_pass http://$hostip:8080/$iname.php;
}
}
如果像这样写正则 server_name ~^(.+).wukong.cn;
然后通过 index $1.php;来反向应用则不行。
转载于:https://blog.51cto.com/renzailvtu/768987