nginx域名隐性(地址栏域名不变)跳转

1、完全url的域名隐性跳转

server_name a.b.com

location / {

               proxy_pass http://x.y.com;

              }

效果:浏览器地址栏中输入a.b.com域名不变访问的内容为x.y.com上的内容

2、部分url的域名隐性跳转到非根目录下的内容

server_name a.b.com

location ~ .*\.(js|css)$ {

                   rewrite ^/(.*) /js/$1 break;

                  proxy_pass http://x.y.com;

}

效果:浏览器地址栏中输入a.b.com以.js或.css结尾的url,域名不变其实访问的内容是x.y.com/js/下的内容。

posted @ 2016-05-11 18:53  su-han  阅读(27315)  评论(0编辑  收藏  举报