在apache或nginx中使用虚拟URL映射子域?

时间:2014-12-24 15:21:51

标签: django apache nginx reverse-proxy

所以我提出了一个要求,即我拥有完整的应用程序,并假设它在mysite.com上运行,它有各种组件,如商店,团队等。

所以网址看起来像(这些网址都是虚拟的 - 我使用的是django,它类似于使用相关功能映射网址,例如,没有名称为&#34的实际目录;存储"或"团队"):


1)mysite.com/store/1/Shoes

2)mysite.com/store/2/Clothing

3)mysite.com/team/1/Marketing

4)mysite.com/team/2/Business

5)mysite.com/team/3/CustomerCare


所以现在我有两个子域名:

a)team.mysite.com

b)store.mysite.com

要求是: 每当有一个请求像store.mysite.com/1/Shoes它打开页面的内容:mysite.com/store/1/Shoes

Similaly如果请求来自team.mysite.com/1/Marketing,它将打开页面内容:mysite.com/team/1/Marketing

因此,在上述两种情况下,子域名应在浏览器中保持不变。

如何在nginx或apache中执行此类操作(更喜欢nginx)?

0 个答案:

没有答案
相关问题