如何将子域指向Heroku应用程序,并将根域指向另一个Heroku应用程序?

编程入门 行业动态 更新时间:2024-10-27 18:24:08
本文介绍了如何将子域指向Heroku应用程序,并将根域指向另一个Heroku应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我已经购买了一个域名,那么我无法将子域路由到Heroku上托管的Wordpress博客,根域也是另一个Heroku应用程序。在NameCheap上称为 cheese ,我想要路由一个子域,如 blog.cheese 我怎么可能在Heroku上这样做?

我需要在每个Heroku应用程序中放置什么类型的设置?

解决方案

我不知道NameCheap的确切方向,但是将子域重定向到Heroku应用程序的一般方法是将CNAME记录添加到子域。要重定向根域,您需要在区域顶点设置类似CNAME的功能。

子域

blog.cheese将有一个CNAME记录指向myblog.herokuapp,您可能还想为www.blog.cheese创建一个CNAME记录。

示例记录可以是:

名称:blog.cheese TTL :14400 类型:CNAME 地址:myblog.herokuapp

一次两个CNAME记录都设置好了,你需要告诉heroku将域指向你的应用程序。

heroku domains:add - app myblog.herokuapp blog.cheese

如果你对这两个子域都这样做,他们应该现在指向您的Heroku应用程序。

根域

指向根您需要设置几个记录

主机名:@ URL:http:// www。 C heese 记录类型:URL重定向 主机名:www URL:mymainpage.herokuapp 记录类型:CNAME(别名)

一旦这两个记录都设置好,只需通过Heroku调用下面的命令来指向您的域名。

heroku domains:add --app mymainpage.herokuapp cheese

这里有几个地方可以寻找额外的信息。

点击nokecheap域到Heroku

自定义域名Heroku开发中心

I'm having trouble with routing a subdomain to a Wordpress blog hosted on Heroku, and the root domain to another Heroku app.

If I have purchased a domain called cheese on NameCheap and I'd like to route a subdomain like blog.cheese how could I do this on Heroku?

What type of setting would I need to place on each Heroku application?

解决方案

I'm not sure of exact directions for NameCheap but the general way to redirect a subdomain to the Heroku app would be to add a CNAME record to the subdomain. To redirect the root domain you will need to set a CNAME like functionality at the zone apex.

Subdomain

blog.cheese would have a CNAME record pointing to myblog.herokuapp, you may also want to create a CNAME record for www.blog.cheese.

An example record could be:

Name: blog.cheese TTL: 14400 Type: CNAME Address: myblog.herokuapp

Once both CNAME records are set up you will need to tell heroku to point the domain to your app.

heroku domains:add --app myblog.herokuapp blog.cheese

If you do this for both your subdomains they should now point to your Heroku apps.

Root Domain

To point the root domain you will need to set a couple of records

Host Name: @ URL: www.cheese Record Type: URL Redirect Host Name: www URL: mymainpage.herokuapp Record Type: CNAME (alias)

Once both records are setup just call the command below via Heroku to point your domains to it.

heroku domains:add --app mymainpage.herokuapp cheese

Here are a couple of places to look for extra information.

Point namecheap domain to Heroku

Custom Domains | Heroku Dev Center

更多推荐

如何将子域指向Heroku应用程序,并将根域指向另一个Heroku应用程序?

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

发布评论

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

>www.elefans.com

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