Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapter about custom domain setting #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions 03-project-hosting/050-homepage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,17 @@ GitHub 为每一个用户分配了一个二级域名\ ``<user-id>.github.io``\

参见: https://github.com/gotgit/gotgit.github.io/blob/master/CNAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地址无效,可能是上次批量替换时的错误。

https://github.com/gotgit/gotgit.github.com/blob/master/CNAME


2. 然后更改域名\ ``www.worldhello.net``\ 的IP地址,指向域名\ ``gotgit.github.io``\
对应的IP地址(注意不是\ ``github.com``\ 的IP地址)
2. 转到域名提供商的配置页面,设置二级域名\ ``worldhello.net``\跳转到三级域名\ ``www.worldhello.net``\
DNS修改生效时间最长可能需要一天
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实际上 worldhello.net 的二级域名也直接别名指向 gotgit.github.io

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩,www.worldhello.net和worldhello.net都指向gotgit.github.io。你原文中写的是指向\ gotgit.github.io\对应的IP地址,我试过这样设置可以成功,但是github官方文档里没说可以这样设置。可能出现的问题是,github分配的域名\ gotgit.github.io\是固定的,但是这个域名对应的IP地址是可能会变的,所以不能直接指向IP地址。


完成域名的DNS指向后,可试着用\ ``ping``\ 或\ ``dig``\ 命令确认域名\
``www.worldhello.net``\ 和\ ``gotgit.github.io``\ 指向同一IP地址。
3. 在域名提供商的配置页面,创建CNAME记录,使子域名\ ``www``\指向\ ``gotgit.github.io``\。
DNS修改生效时间最长可能需要一天。

4. 在域名提供商的配置页面,创建两条A记录,分别解析为IP地址\ ``192.30.252.153``\和\ ``192.30.252.154``\。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

设置两条 A 记录没有必要

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

设置两条A记录是github帮助页面写的,我不是很清楚这样设置的原因。可能是互为备份吧。

DNS修改生效时间最长可能需要一天。

完成域名的DNS指向后,可试着用\ ``ping``\ 或\ ``dig``\ 命令确认域名\ ``www.worldhello.net``\
和\ ``gotgit.github.io``\ 指向同一IP地址。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping 命令确认IP指向一致。dig 命令诊断域名解析方式。

$ dig www.worldhello.net

; <<>> DiG 9.8.3-P1 <<>> www.worldhello.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16993
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.worldhello.net.            IN      A

;; ANSWER SECTION:
www.worldhello.net.     3600    IN      CNAME   gotgit.github.io.
gotgit.github.io.       3600    IN      CNAME   github.map.fastly.net.
github.map.fastly.net.  30      IN      A       103.245.222.133

::

Expand Down