Apache 配置将多个仅限本地的 http 站点呈现为单个公共 https 站点
我确信有一个简单的解决方案 - 但我已经用我的头撞了 Apache 文档似乎永远......也许有人可以给我一个提示?
在局域网上,我有多个网站(我们应该假设它们具有不透明的实现),每个网站都在单独的域下运行......并且这些网站工作得很好。
我想通过 https 公开这些网站,但我只能访问一个合适的 IP 地址 - 因此需要将 /app1/ 路径映射到具有 app1 主机名的内部站点 - 并将 /app2/ 路径映射到内部站点具有 app2 主机名的站点 - 这是我的目标。
我尝试过使用“Apache Module mod_proxy” - 并且我尝试过 ProxyPass、ProxyPassReverse 和部分的各种组合 - 都遇到了同样的问题。 http://app1.example.com/ 站点包含引用以下形式的 uri 的页面: /submit.php”和“/base.css” - 相对于多个 http 站点方案工作 - 但在需要多个根的公共 https 方案中是错误的 - 由公共 URI 中路径的前缀标识。
确保正确翻译这些 URI 的最佳方法是什么? mod_proxy 适合此类任务吗?
I'm sure there's a simple solution - but I've banged my head against Apache documentation for what seems like forever... perhaps someone can give me a hint?
On a LAN, I've multiple websites (which, we should assume, have opaque implementations) each operating under a separate domain... and these work just fine.
I want to expose these websites over https, but I only have access to a single suitable IP address - making it desirable to map an /app1/ path to the internal site with an app1 hostname - and a path of /app2/ to the internal site with an app2 hostname - and this is my objective.
I've tried playing with "Apache Module mod_proxy" - and I've tried various combinations of ProxyPass, ProxyPassReverse and sections - all with the same problem. The site at http://app1.example.com/ contains pages that make references to uris of the form "/submit.php" and "/base.css" - which work relative to the multiple http site scheme - but are wrong in the public https scheme where there needs to be multiple roots - identified by the prefix of the path in the public URI.
What's the best way to go about ensuring these URIs are translated properly? Is mod_proxy appropriate for this sort of task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要 SNI,服务器名称标识。
你想要实现的目标是Web服务器本身无法实现的,它需要客户端很好,只有在发送域名后才启动加密会话,否则,这是不可能的。
这是一个教程,科技共和国,祝你好运。
You need SNI, server name identification.
What you want to achieve can't be achieve by a web server on its own, it needs the client to be nice and start the encrypted session only after it has sent the domain name, otherwise, it is not possible.
Here is a tutorial, techrepublic, good luck.
万一它可以帮助其他人...
我最终的解决方案是使用 mod_proxy 将请求从 SSL 服务器反弹到我的内部服务器...但是,由于各种原因,事实证明,将 URI 转换为单独的文件要容易得多托管内部服务器的阶段。我使用 mod_rewrite 来去除路径前缀 - 它的工作方式非常迷人。
遗憾的是,在 SSL 服务器的配置中没有明显的方法来做到这一点(如果我只是忽略了它,请纠正我)并且我浪费了很多时间来追求 mod_html_proxy - 这对于 html 来说是相当严格的会翻译。无论如何,在 Apache 中翻译选定的 URI 比让 Apache 翻译整个文档更好。
In case it helps other people...
My eventual solution was to use mod_proxy to bounce requests from the SSL server to my internal servers... but, for various reasons, it turns out to be far easier to translate the URI in a separate stage where the internal servers are hosted. I used mod_rewrite to strip the path prefix - and it works charmingly.
It is a pity that there is no obvious way to do this in the configuration of the SSL server (please correct me if I've just overlooked it) and I wasted a lot of time pursuing mod_html_proxy - which was rather strict about the html it would translate. In any case, it is preferable to translate the selected URIs in Apache than to get Apache to translate entire documents.