简体   繁体   English

如何使用Heroku设置自定义域名?

[英]How to setup custom domain names with Heroku?

I am attempting to follow the documentation from Heroku to add a custom domain name for my Ruby on Rails application. 我试图按照Heroku的文档为我的Ruby on Rails应用程序添加自定义域名。 In my CLI I have added the domain and it is viewable when I run heroku domains: 在我的CLI中,我已经添加了域,并且在运行heroku域时可以看到它:

The Domain Name points to my address and the DNS Target points to my Heroku App address. 域名指向我的地址,DNS目标指向我的Heroku App地址。

Inside my domain registrar, (GoDaddy), I set the CNAME to my Heroku address. 在我的域名注册商(GoDaddy)中,我将CNAME设置为我的Heroku地址。 The domain has propagated for enough time and it just displays that it is being parked when I access it. 该域已经传播了足够的时间,并且在我访问它时仅显示该域已被驻留。

What am I doing incorrectly? 我做错了什么?

I had a very similar problem with Godaddy except I was also dealing with not only forwarding www.something.com to my herokuapp but also the something.com forwarding to the same app (without the www). 我在Godaddy遇到了一个非常相似的问题,除了我不仅要处理将www.something.com转发到我的herokuapp,而且还要处理something.com转发到同一应用程序(不使用www)。

Here's what I suggest you do 这是我建议你做的

Check in your heroku settings under domains you have something like this 检查您在域名下的heroku设置

domain_name: www.something.com    DNS_Target: something.herokuapp.com
   domain_name: something.com        DNS_Target: something.herokuapp.com

On Godaddy, under domain details > settings, make sure your forwarding looks like this 在Godaddy上,在“域名详细信息”>“设置”下,确保您的转发如下所示

Forwarding:   Domain: http://something.herokuapp.com/(forward only)

Now under the DNS Zone file make sure you have a CNAME (Alias) record that looks like this below ... ps. 现在,在DNS区域文件下,确保您具有一个如下所示的CNAME(别名)记录... ps。 this section has a (page 1 of 2) pagination at the bottom of the CNAME section if you don't see your record it could be on the next page 如果您看不到记录,则此部分在CNAME部分的底部具有分页(第1页,共2页)

host: www   points_to: something.herokuapp.com   ttl: 600 seconds

now the important part is under your A (Host) records you need to change the @ host to point to a this exact ip address ... 现在重要的部分在您的A(主机)记录下,您需要更改@主机以指向此确切的IP地址...

host: @   points_to:   174.129.25.170   ttl: 600 seconds

when i dealt with this problem, this SO question/answers helped me do that ^ which solved my issues. 当我处理这个问题时, 这个SO问题/解答帮助我完成了^,从而解决了我的问题。 Especially the @ points_to that ip address 尤其是@ points_to该IP地址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM