最近有一个产品完成了它的使命须要下线,而且有新的产品须要上线并替代它。nginx
用人话说,就是服务器
旧产品在页面上大量经过地址http://foo.com进行了投放less
如今要将http://foo.com/**/..下的任意资源访问重定向到http://bar.com下的一个特定资源,例如http://bar.com/foo测试
用膝盖思考了一下,有这样一个方案。spa
测试了一把,验证经过code
最后的nginx配置为:server
server { listen 80; server_name foo.com; root /home/homeless location / { rewrite ^ /bar break; proxy_pass http://127.0.0.1:8080; } }
今天回家跑步图片