如何将不同子域的请求重定向到不同的服务器

发布于 2024-07-14 01:16:45 字数 339 浏览 4 评论 0 原文

在我的域下,其中一个子域必须定向到托管相关应用程序的一台服务器,其余子域必须定向到托管相关应用程序的另一台服务器。

因此,对 url appa.example.com\* 的任何请求都必须定向到一台服务器,并且对 url appb.example.com\* 的任何请求都必须定向到一台服务器。定向到另一台服务器。

现在的问题是如何在两台服务器上配置 Apache 配置——也许使用 ProxyPass 或 ProxyPassReverse 等配置,以便所有传入请求都可以正确定向到正确的服务器?

编辑以使问题更清晰。

Under my domain, one of the subdomain must be directed to one server that hosts the relevant applications, and the rest must be directed to another server that hosts the relavant applications.

So, any requests to the url appa.example.com\* must be directed to one server, and any requests to the url appb.example.com\* must be directed to another server.

The issue now is how to configure the Apache configuration on both servers-- maybe using configuration like ProxyPass or ProxyPassReverse so that they all the incoming requests can be directed correctly at the correct server?

Edit to make the question clearer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

樱桃奶球 2024-07-21 01:16:45

将 URL 链接到 IP(服务器)的地方是 DNS。

例如,如果服务器 A 位于 1.2.3.4,服务器 B 位于 5.6.7.8,则将 appa.example.com 链接到 1.2.3.4,将 appb.example.com 链接到 5.6.7.8。

但是,如果两台服务器都位于防火墙后面(具有单个外部 IP 地址),则您必须执行一些技巧。 (您可能正在寻找这些技巧)。

查看在 Apache 服务器上重定向 URL 简介

The place to link an url to an IP (server) is the DNS.

For example if server A is at 1.2.3.4 and server B at 5.6.7.8 you link appa.example.com to 1.2.3.4 and appb.example.com to 5.6.7.8.

But if both servers are behind a firewall (with a single external IP address) you have to perform some tricks. (And you are probably looking for these tricks).

Have a look at An Introduction to Redirecting URLs on an Apache Server.

帝王念 2024-07-21 01:16:45

我为我的工作场所(大学)做了同样的事情。 我们的主要网站托管在其他地方,但部分网站(学生注册系统)托管在现场。

我所做的是创建权威 (A) DNS 记录 (reg.domain.com) 并使其指向我们现场服务器的IP。 这就成功了!

这是我的域 CP 的相同屏幕截图(由于显而易见的原因,域和 IP 被屏蔽)...
替代文本 http://img443.imageshack.us/img443/5069/stiuaregrecord.jpg< /a>

这本质上与您想要做的相同。 试一试看看:)

I've done the same thing for my workplace (a University). Our primary website it hosted elsewhere but part of the site (student registration system) is hosted onsite.

What I did was to create a Authoritative (A) DNS Record (reg.domain.com) and made it point to the IP of our onsite server. And that did the trick!!!

Here's a screenshot of the same from my domain CP (domain and IP masked for obvious reasons)...
alt text http://img443.imageshack.us/img443/5069/stiuaregrecord.jpg

It's essentially the same as what you're trying to do. Give it a shot and see :)

素衣风尘叹 2024-07-21 01:16:45

在目标子域的父域的 DNS 记录/管理器中:

  • 将子域名指向要主机服务器的 IP 地址,然后 ...

... 然后 ...

在主机服务器 DNS 和/或服务器软件中config:将子域定向到网站应用程序。 您可以通过以下方法之一实现此目的: -

  • 手动编辑 DNS 记录、
  • 停放子域并将其指向网站文档根文件夹,或
  • 添加域和子域(域将永远不会被使用,因为它未指向适用的服务器)。 将它们都指向您现在的子域(如果有这样一个词)网站应用程序的文档根目录

In the DNS records/manager for the parent domain of the intended subdomain:

  • point the subdomain name at the to-be host servers IP address, then ...

... Then ...

In the host server DNS and or server-software config: direct the subdomain to the website app. You can achieve this by one of: -

  • manually edit the DNS records,
  • park the subdomain and point it at the website document root folder, or
  • add the domain and subdomain (domain will never be used since its not pointed at applicable server). Point them both at the document root for your now subdomained (if there is such a word) website app
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文