nginx - 配置 - 端口号跟随域名变化 nginx



# nginx的配置文件,功能是将 http://12345.test.com 的访问转换为内网 http://127.0.0.1:12345 的访问。

-端口号跟随域名变化。


       server_name *.test.com;


        location / {  

            proxy_connect_timeout 5s;

            if ($host ~* (\d+?)\..+){

                set $userport $1;

                proxy_pass http://127.0.0.1:$userport;

            }

            root html;

        }  


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回