【问题标题】:How can I setup an Apache ProxyPass to a subdirectory which overrides a parent ProxyPass?如何将 Apache ProxyPass 设置到覆盖父 ProxyPass 的子目录?
【发布时间】:2016-01-11 14:31:09
【问题描述】:

我在给定的机器上运行了多个 Web 服务器(Apache、Tomcat、自定义 Python 服务器)。我有 Apache 在端口 80 上侦听,标准设置也是如此。为了通过此端口访问我的其他服务器之一,我在 Apache 中设置了一个 ProxyPass,如下所示:

ProxyPass / http://[mydomainname]:8880/
ProxyPassReverse / http://[mydomainname]:8880/

它有效。当您浏览到没有端口规范的域名(因为隐含 80)时,您不会到达 Apache 根目录,而是透明地重定向到机器上另一台服务器(Twisted 服务器)的根目录,该服务器侦听端口 8880。

这就是问题所在。看来我现在已经阻止任何东西访问我的 Apache 文件。有没有办法覆盖各种子目录的根代理通行证?例如,如果您浏览到 mydomain/test,我是否可以让它像我根本没有代理通过一样工作,而不是将其路由到端口 8880 服务器上的路径?

【问题讨论】:

    标签: apache tomcat proxypass


    【解决方案1】:

    我在 SO 线程上找到了答案:ProxyPass and DocumentRoot on one domain

    在根 ProxyPass 指令之前,只需添加 ProxyPass 排除项和目录别名。注意:对要公开的每个 Apache 子目录重复此操作。

    ProxyPass /MySubDirectory !
    Alias /MySubDirectory /var/www/html/MySubDirectory
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-13
      • 2015-11-22
      • 2013-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-14
      相关资源
      最近更新 更多