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
最后
以上就是时尚白猫最近收集整理的关于nginx server_name正则匹配二级域名的全部内容,更多相关nginx内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复