<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>域名 on kenji.blog</title><link>http://kenji.blog/zh-cn/tags/%E5%9F%9F%E5%90%8D/</link><description>Recent content in 域名 on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><copyright>kenjinote</copyright><lastBuildDate>Tue, 13 Sep 2022 01:16:40 +0900</lastBuildDate><atom:link href="http://kenji.blog/zh-cn/tags/%E5%9F%9F%E5%90%8D/index.xml" rel="self" type="application/rss+xml"/><item><title>如何为 Github 仓库配置自定义域名</title><link>http://kenji.blog/zh-cn/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/</link><pubDate>Tue, 13 Sep 2022 01:16:40 +0900</pubDate><guid>http://kenji.blog/zh-cn/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/</guid><description>&lt;img src="http://kenji.blog/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/octocat.png" alt="Featured image of post 如何为 Github 仓库配置自定义域名" />&lt;p>要为 Github 仓库配置自定义域名，你需要修改域名的 DNS 设置。
这里我们假设你是在
&lt;a href="https://px.a8.net/svt/ejp?a8mat=3TJBXA+BKRHS2+50+2HHVNM" rel="nofollow">お名前.com&lt;/a>
&lt;img border="0" width="1" height="1" src="https://www19.a8.net/0.gif?a8mat=3TJBXA+BKRHS2+50+2HHVNM" alt="">
管理你的域名来进行说明。
在其他注册商处，也可以通过重写 A 记录来进行类似的设置。&lt;/p>
&lt;h2 id="在お名前com中修改-dns-设置">在お名前.com中修改 DNS 设置
&lt;/h2>&lt;p>要修改域名的 DNS 设置，请登录
&lt;a href="https://px.a8.net/svt/ejp?a8mat=3TJBXA+BKRHS2+50+2HHVNM" rel="nofollow">お名前.com&lt;/a>
&lt;img border="0" width="1" height="1" src="https://www19.a8.net/0.gif?a8mat=3TJBXA+BKRHS2+50+2HHVNM" alt="">
的管理界面。
登录后，进入域名管理界面。
进入域名管理界面后，修改 DNS 设置。
要修改 DNS 设置，请按照以下步骤操作：&lt;/p>
&lt;ol>
&lt;li>访问 &lt;a class="link" href="https://www.onamae.com/" target="_blank" rel="noopener"
>https://www.onamae.com/&lt;/a> 并点击“お名前.com Navi 登录”&lt;/li>
&lt;li>输入“お名前ID（会员ID）”和“密码”，然后点击登录按钮&lt;/li>
&lt;li>点击“名称服务器设置”&lt;/li>
&lt;li>点击“域名的 DNS 设置”&lt;/li>
&lt;li>选择要设置的域名，然后点击“下一步”&lt;/li>
&lt;li>点击“使用 DNS 记录设置”右侧的“设置”&lt;/li>
&lt;li>在 TYPE 中选择 A，在 TTL 中输入 3600，在 VALUE 中输入“185.199.108.153”，然后点击“添加”&lt;/li>
&lt;li>按照与步骤 7 相同的方法，添加“185.199.109.153”、“185.199.110.153”和“185.199.111.153”&lt;/li>
&lt;li>确认勾选了“DNS 记录设置用名称服务器更改确认”，然后点击“进入设置界面”&lt;/li>
&lt;li>如果出现“为了防止意外的 DNS 设置更改”的界面，请点击“不设置”（可根据需要选择）&lt;/li>
&lt;li>确认设置内容，然后点击“设置”
&lt;img src="http://kenji.blog/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img.png"
width="656"
height="140"
srcset="http://kenji.blog/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_hu4809a0e7ac5f7d8dfe8c6643786c9385_7354_480x0_resize_box_3.png 480w, http://kenji.blog/p/github%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AB%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_hu4809a0e7ac5f7d8dfe8c6643786c9385_7354_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img.png"
class="gallery-image"
data-flex-grow="468"
data-flex-basis="1124px"
>&lt;/li>
&lt;li>这样 DNS 设置就完成了。最多可能需要约 72 小时才能完成生效。&lt;/li>
&lt;li>如果 72 小时后仍未生效，请尝试联系お名前.com的支持人员。&lt;/li>
&lt;/ol>
&lt;p>要在本地环境中确认设置是否已生效，请尝试运行以下命令。
请将 &lt;code>example.com&lt;/code> 替换为您要确认的域名。&lt;/p>
&lt;h3 id="对于-linuxmac">对于 Linux、Mac
&lt;/h3>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">dig example.com +noall +answer -t A
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>如果结果如下所示，则说明设置已生效。&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">example.com. &lt;span class="m">0&lt;/span> IN A 185.199.108.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">example.com. &lt;span class="m">0&lt;/span> IN A 185.199.109.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">example.com. &lt;span class="m">0&lt;/span> IN A 185.199.110.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">example.com. &lt;span class="m">0&lt;/span> IN A 185.199.111.153
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="对于-windows">对于 Windows
&lt;/h3>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">nslookup -q&lt;span class="o">=&lt;/span>a example.com 8.8.8.8
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>如果结果如下所示，则说明设置已生效。&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;span class="lnt">9
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">服务器: dns.google
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Address: 8.8.8.8
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">非权威应答:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">名称: example.com
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Addresses: 185.199.108.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> 185.199.109.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> 185.199.110.153
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> 185.199.111.153
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="为-github-仓库配置自定义域名">为 Github 仓库配置自定义域名
&lt;/h2>&lt;ol>
&lt;li>打开仓库页面，点击 Settings&lt;/li>
&lt;li>点击 Pages&lt;/li>
&lt;li>如果直接发布仓库源码，在 Source 中选择“Deploy from a branch”。如果需要编译源码（如 HUGO），则选择“GitHub Actions”。&lt;/li>
&lt;li>在 Branch 中选择要发布的分支，然后点击 Save&lt;/li>
&lt;li>在 Custom domain 中输入已获取的域名，然后点击 Save。&lt;/li>
&lt;li>根据需要勾选“Enforce HTTPS”以启用 HTTPS 支持&lt;/li>
&lt;/ol>
&lt;p>[PR]
&lt;a href="https://px.a8.net/svt/ejp?a8mat=3TJBXA+BKRHS2+50+2HQGAP" rel="nofollow">
&lt;img border="0" width="468" height="60" alt="" src="https://www24.a8.net/svt/bgt?aid=231009310700&amp;wid=003&amp;eno=01&amp;mid=s00000000018015072000&amp;mc=1">&lt;/a>
&lt;img border="0" width="1" height="1" src="https://www14.a8.net/0.gif?a8mat=3TJBXA+BKRHS2+50+2HQGAP" alt="">&lt;/p></description></item></channel></rss>