Heroku上的自定义根域

编程入门 行业动态 更新时间:2024-10-14 06:21:33
本文介绍了Heroku上的自定义根域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个域,example,我想用于我的rails-app驻留在example.herokuapp,我很困惑如何去做这个。

I have a domain, example, that I want to use for my rails-app that resides at example.herokuapp and I'm pretty confused how to go about to do this.

Heroku说

区域顶点域名(又称裸体,裸或根域),例如 example,使用常规DNS A记录不支持 Heroku。然后他们继续解释解决方法(使用ALIAS或 ANAME)。

"Zone apex domains (aka "naked", "bare" or "root" domains), e.g., example, using conventional DNS A-records are not supported on Heroku." And then they go on explaining workarounds (using ALIAS or ANAME).

我花了一个很好的时间阅读这个主题(这里是SO和其他地方),但是仍然没有得到我的关注。

I have spent a good hour reading up on the subject (here on SO and elsewhere) but still don't get my head around this.

有没有任何替代方法或解释如何解决这个问题虚拟?

Are there any alternative ways or explanations on how to acomplish this for "a dummy"?

推荐答案

我会采取一个刺,因为这是一个常见的问题。

I'll take a stab at this as it's a frequent question.

好的,假设你有一个域example,你想使用www.example托管你的网站。在传统的托管中,您可能有一个虚拟服务器被分配了一个IP地址,在这种情况下,您将使用主机记录,也称为DNS控制面板中的A记录,以将www.example映射到IP地址。在这种情况下,由于您现在已将www.example设置为固定的IP地址,如果IP地址发生更改,则需要自行更新DNS。

Ok, so assuming you have a domain example and you want to use www.example to host your site. In traditional hosting you'd probably have a virtual server which has been assigned an IP address, in this case you would use a host record, otherwise known as an A record in DNS control panels to map www.example to the IP address. In this case, since you have now set www.example to a fixed IP address should that IP address ever change you will need to update your DNS yourself.

另外与传统的托管您可以将example设置为相同的IP地址,因此www.example和example将适用于裸域。

Also, with traditional hosting you could have example set to the same IP address so www.example and example would work for naked domains.

什么是CNAME记录? CNAME记录而不是映射到IP地址将记录映射到另一个DNS条目。所以,www.example的示例CNAME的例子意味着Heroku可以并且可能移动example.herokuapp所指向的位置,但是您不需要更新任何内容,因为您使用CNAME记录,而Heroku是管理example.herokuapp指向哪里(可以是另一个CNAME或IP地址)。 CNAME记录的问题是它们不能指向IP地址,对于www.example而言,这是一个很好的例子,但是与example有关。 Heroku以前发布了用于裸机域的IP地址,但是遇到DDOS攻击时出现问题,并且无法用新的IP地址替换这些IP。对于新的欧盟地区,Heroku不会发布用于裸机域的IP地址。

Ok, so what's a CNAME record. A CNAME record rather than mapping to an IP address maps the record to another DNS entry. So, www.example CNAME'd to example.herokuapp means that Heroku can and may move where example.herokuapp is pointing at but you don't have to update anything as you're using an CNAME record and Heroku are managing where example.herokuapp is pointing (which can and may be another CNAME or an IP address). The problem with CNAME records is that they CANNOT point to an IP address, which is fine for www.example but a problem with example. Heroku previously published IP addresses to be used for naked domains but problems ensued when they suffered DDOS attacks and couldn't replace those IPs with new ones as they were published IP addresses. For the new EU region, Heroku ARE NOT publishing IP addresses for use with naked domains.

几个DNS提供程序(我知道的DNSsimple)已经做了,是添加自己的ALIAS记录到他们的DNS服务器,以允许您使用裸体域的CNAME,因此www.example和example将像Heroku一样支持。如果您的DNS提供商不支持ALIAS记录,那么值得将域名移动到支持它的DNS提供商。 DNSsimple还支持重定向记录,因此您可以将www.example重定向到DNS提供商级别的example,而不是应用层。

What several DNS providers (DNSsimple I know is one) have done is add their own ALIAS records to their DNS servers to allow you to use CNAME's with naked domains so both www.example and example will work as now supported by Heroku. If you DNS provider does not support ALIAS records then it's worth moving the domain to a DNS provider that does support it. DNSsimple also supports redirect records so you can have www.example redirect to example at the DNS provider level and not at your application layer.

更多推荐

Heroku上的自定义根域

本文发布于:2023-11-28 12:33:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642414.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   Heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!