如何将域名指向托管在github页面上的站点? [英] How to point domain to site hosted on github pages?

查看:196
本文介绍了如何将域名指向托管在github页面上的站点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个网站,并将其放在github的回购与USRNAME.github.com。首先,当我去那个网站,我的网站显示正确。然后我买了一个域名,让我们说example.com。我将一个CNAME文件放在了repo中,所以现在USRNAME.github.com转发到example.com。

I have created a website and placed it on github in the repo with USRNAME.github.com. First when I went to that website, my website displayed correctly. Then I bought a domain, lets say example.com. I placed a CNAME file in the repo, so now USRNAME.github.com forwards to example.com.

我明白我必须将域名指向github服务器为了让我的网站在example.com上显示,但我不知道如何。我通过gandi.net创建了该网站。我尝试编辑区域文件以具有USRNAME.github.com的CNAME条目,但没有工作。我也尝试编辑DNS服务器名称,但是我没有在这里放置的条目似乎有效。

I understand that I have to point my domain at the github server in order to allow my website to be displayed at example.com, but I'm not sure how. I created the site through gandi.net. I tried editing the zone file to have a CNAME entry with USRNAME.github.com but that didn't work. I also tried to edit the DNS server name but no entry I placed in there seemed valid.

任何帮助将不胜感激。谢谢。

Any help would be greatly appreciated. Thanks.

推荐答案

据了解,github端的CNAME文件必须通过注册商端的自定义DNS设置完成,以便完成您的域名(example.com)和github上的子域之间的匹配。 github需要CNAME文件将传入的请求路由到自己的DNS区域(192.30.252.153)到适当的用户子域。

As you understood, the CNAME file on the github side must be completed by a custom DNS setting on the registrar side, in order to complete the matching between your domain name (example.com) and the subdomain on github. The CNAME file is required by github to route incoming request on its own DNS Zone (192.30.252.153) to the proper user subdomain.

因此,缺少的步骤是让您的域实际上指向github的DNS区域。在注册商方(gandi.net),您可以通过编辑附加到您的域的DNS区域文件来实现。该区域文件描述了您的域名所属的DNS区域的分层域名结构。您要做的是更改DNS区域和IP的某些部分之间的映射。当您想将基于顶级的域名指向任意的IP v4(此处,github的DNS Zone位于192.30.252.153)时,您有兴趣重新定义A记录(简称为地址),在您的自己的区域。

Therefore, the missing step is having your domain actually pointing to github's DNS Zone. On the registrar side (gandi.net), you achieve that by editing the DNS Zone file attached to your domain. This zone file describes the hierarchical domain name structure of the DNS Zone that your very domain pertains to. What you are about to do is changing the mapping between some parts of your DNS Zone and IPs. When you want to point a top-level-based domain name to an arbitrary IP v4 (here, github's DNS Zone located at 192.30.252.153), you are interested in redefining an A Record (A simply standing for "Address") in your own zone.

gandi.net的具体答案:

A specific answer for gandi.net:

在此您可以看到您的区域文件的设置列表。 Gandi的一个新功能是版本:可以创建不同版本的区域文件,一次只能启用一个。

Here you can see the list of settings for your zone file. A new feature of Gandi is that of "versions": different versions of the zone file can be created and only one is active at a time.

调整区域文件对于github,首先点击创建新版本。它将简单地创建一个当前激活的版本的副本。

To tweak the zone file for github, first click on "Create a new version". It will simply create a copy of the currently activated version.

首选的布线方式是添加一个新的CNAME映射,从*。{yourdomain.tld}到{ youraccount} .github.io。例如,我的kaibun.net域必须是chikamichi.github.io的外观,所以我添加了一个CNAME映射* .kaibun.net到chikamichi.github.io。 (gandi的配置中最后一个点是强制性的)。

The preferred way for wiring is to add a new CNAME mapping, from *.{yourdomain.tld} to {youraccount}.github.io. For instance, my kaibun.net domain must be the facade for chikamichi.github.io, so I added a CNAME mapping *.kaibun.net to chikamichi.github.io. (the final dot is mandatory in gandi's config).

您也可以编辑*和@记录类型设置,例如,如果您只想要整个DNS区域表现得像一个代理(意味着它将重定向到您的github子域,无论什么)。这不是必需的,所以这一步是可选的。我假设你还处于正常编辑模式。点击*行右侧的笔图标。保持所有字段不变,但值一个:粘贴github URI(github文档建议使用204.232.175.78;您可能已经在互联网上找到不同的值,但不要使用它们)。验证,然后对@行进行相同。

You may want to edit the * and @ record types settings as well, for instance if you just want the whole DNS zone to behave like a "proxy" (meaning it will "redirect" to your github subdomain no matter what). This is not required though, so this step is optional. I assume you are still in Normal edit mode. Click on the Pen icon on the right side of the * line. Keep all fields untouched but the "Value" one: paste the github URI in (the github documentation recommends using 204.232.175.78; you may have found different values on the internet, though: don't use them). Validate, then proceed the same for the @ line.

准备好后,请勿忘记点击激活此版本。检查活动版本号是否正确。更改将需要一些时间来传播。

Do not forget to click on "Activate this version" when you're ready. Check that the "Active version number" is correct. The changes will take some time to propagate.

详细的示例和过程: http://wiki.gandi.net/dokuwiki/en/dns/zone/a-record

这篇关于如何将域名指向托管在github页面上的站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆