代码之家  ›  专栏  ›  技术社区  ›  jacobangel

将内部路径重定向到虚拟主机

  •  3
  • jacobangel  · 技术社区  · 17 年前

    我已经在drupal测试站点上工作了一段时间,它有一组虚拟主机,设置如下:

    <VirtualHost *:80>
    ServerAdmin email@example.com
    DocumentRoot "/path/to/root"
    ServerName testsite1.example.com
    </VirtualHost>
    

    12.0.0.1 localhost
    20.02.2.22 testsite1.example.com
    20.02.2.22 testsite2.example.com
    20.02.2.22 testsite3.example.com
    

    有没有一种方法可以设置Apache,使url“ http://20.02.2.22/testsite1 “是否会在内部转发到testsite1.example.com?我正在使用Drupal,站点设置需要查看“testsite1.example.com”,以便它能够正确选择要选择的实例。我一直在查看apache重写,但我在这方面有点新手,因此非常感谢任何帮助。”。

    3 回复  |  直到 17 年前
        1
  •  3
  •   vartec    17 年前

    testsite1.example.com将仅在您的计算机上解析,因此您无法重定向。您可以使用mod_proxy设置代理。希望这对你有用:

    <VirtualHost *:80>
      ServerAdmin email@example.com
      DocumentRoot "/path/to/root"
      ServerName testsite1.example.com
      ServerAlias 20.02.2.22
      <Location /testsite1/>
        ProxyPass http://testsite1.example.com/ 
      </Location>
    </VirtualHost>
    
        2
  •  0
  •   fmitchell    17 年前

    在内部,我的Drupal站点位于[我的机器ip]或本地主机。

    我在我的IP上设置了一个免费的动态dns名称,然后在我的路由器上,接受端口上的传入请求以路由到[我的机器IP]

        3
  •  -1
  •   xZero    13 年前

    为什么你不买一个新域名并把它指向你的服务器IP地址。。。

    http://www.dot.tk/en/index.html?lang=en
    or
    http://dyn.com/dns/
    

    http://server2.elite7hackers.us/recommend.php?site=godaddy