域管理(多服务器)

发布于 2024-07-16 01:11:09 字数 304 浏览 4 评论 0原文

这是我的场景:

我有两个托管在不同服务器上的 Web 应用程序。 我想做的是请求“*.mydomain.com”(即没有子域,“www”等)转到第一台服务器,并请求“mysubdomain.mydomain.com”转到第二个服务器。 我该如何实现这个目标?

这只是我的域名注册商的“CNAME”设置吗? 比如“www.mydomain.com”到IP 11.11.111.111?

我知道这不一定与编程相关; 然而,我认为这个问题也会对网站上的其他人有所帮助,因为大多数问题都与网络开发相关。

谢谢!

Here's my scenario:

I have two web applications that are hosted on seperate servers. What I'd like to do is have requests for "*.mydomain.com" (i.e. no subdomain, 'www', etc) to go to the first server, and requests for "mysubdomain.mydomain.com" to go to the second server. How do I accomplish this?

Is it just a "CNAME" setting with my domain registrar? like "www.mydomain.com" to ip 11.11.111.111?

I know this isn't necessarily programming related; however, I figured the asnwer would be helpful to others on the site as well, since most questions are web development related.

Thanks!

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

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

发布评论

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

评论(3

你曾走过我的故事 2024-07-23 01:11:09
CNAME mysubdomain second.server
CNAME *  first.server
CNAME mysubdomain second.server
CNAME *  first.server
前事休说 2024-07-23 01:11:09

正如之前的回复所述,CNAME 是正确的。 您也可以添加 A 记录。

您需要指定您想要指向 *.mydomain.com 的服务器 IP 地址,以及指向其他服务器的 mysubdomain.mydomain.com 的另一条 A 记录。

确保从 mydomain.com 指向并工作的服务器添加这些 DNS 记录。

CNAME is correct as stated in previous reply. You can add the A record too.

You will need to specify the server IP address where you would like to point *.mydomain.com and one more A record for mysubdomain.mydomain.com pointing to other server.

Make sure to add those DNS records from the server where mydomain.com is pointing and working.

花开半夏魅人心 2024-07-23 01:11:09

我不清楚您是否只需要根域 mydomain.com 的 DNS 解析,或者是否需要通配符子域 (*)(表示任何子域)。

如果您知道第一台和第二台服务器的名称,即。 first-server.com 和 secondary-server.com,那么您将使用 CNAME 记录,在 mydomain.com 区域中添加或更改:

*.mydomain.com. IN CNAME first-server.com.
mysubdomain.mydomain.com. IN CNAME second-server.com.

如果您拥有 IP 而不是名称,并且您可以控制这些 IP,我意味着这些IP不会在您不知情的情况下更改,然后使用A记录,在mydomain.com的区域中添加或更改:

*.mydomain.com. IN A XXX.XXX.XXX.XXX
mysubdomain.mydomain.com. IN A YYY.YYY.YYY.YYY

其中XXX是第一台服务器的IP,YYY是第二台服务器的IP。

注意:

如果您当前有 A 记录,则必须将其删除才能设置 CNAME,不能同时拥有两者。

如果您不需要通配符子域,而是需要根域解析,那么 CNAME 将不起作用,因为会与 SOA 记录冲突,在这种情况下,A 记录是必须的。

Is not clear to me if you just need a DNS resolution for your root domain mydomain.com or if you need a wildcard subdomain (*) which will means any subdomain.

If you know the the first and second server by their name, ie. first-server.com and second-server.com, then you will use CNAME Records, in the zone of mydomain.com add or change:

*.mydomain.com. IN CNAME first-server.com.
mysubdomain.mydomain.com. IN CNAME second-server.com.

If you have the IPs instead of the names, and you are in control of those IPs, I mean that those IPs will not change without your knowledge, then use A records, in the zone of mydomain.com add or change:

*.mydomain.com. IN A XXX.XXX.XXX.XXX
mysubdomain.mydomain.com. IN A YYY.YYY.YYY.YYY

where XXX is the IP of the first server and YYY the ip of the second server.

NOTES:

If you have currently an A record, you will have to remove it in order to set the CNAME, you cant have both.

If you don't want a wildcard subdomain but a root domain resolution, then a CNAME will not work, that is because will conflict with SOA records, in that case an A record is a must.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文