所以我想得到一个自定义域与我的 github 页面一起使用用户站点。我几乎遵循了执行此操作的标准程序,如下所示:(github 也在这里推荐:https://help.github.com/articles/setting-up-an-apex-domain-and-www-subdomain/ https://help.github.com/articles/setting-up-an-apex-domain-and-www-subdomain/)。请注意,我需要顶点域 (example.com) 和 www 子域 (www.example.com) 才能解析到位于 username.github.io 的我的 github 页面用户站点(该网站本身是一个基于 Jekyll 的博客并且在开始此过程之前我已检查它是否已成功编译)
- I added an A record to my DNS records at the registrar pointing to all of the four IP addresses provided by Github from the apex domain example.com:
- 185.199.108.153
- 185.199.109.153
- 185.199.110.153
- 185.199.111.153
- 接下来我进去添加了一个www 的 CNAME 记录指向 username.github.io 的子域
- 然后我最终在存储库的设置选项卡下启用了自定义域 example.com(在 Github Pages > 自定义域下),并且还启用了强制执行 HTTPS启用后大约一个小时内的选项。
我尝试联系我的注册商,他们说 DNS 记录中的所有内容看起来都很好,他们得到以下结果:
一条记录:
example.com。 21460 于 185.199.111.153
example.com。 21460 在 185.199.109.153
example.com。 21460 于 185.199.110.153
example.com。 21460 在 185.199.108.153
CNAME :
www.example.com。 7199 在 CNAME 用户名.github.io 中。
正如预期的那样。
但我仍然在 github 中收到以下错误(在存储库的设置选项卡下):
"域无法解析到 GitHub Pages 服务器。有关更多信息,请参阅https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/ https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/."
当我尝试通过输入 example.com 或 www.example.com 访问该网站时,浏览器会重定向到https://example.com/ https://example.com/我收到错误(在 Chrome 上):
ERR_CONNECTION_REFUSED
请注意,github 的文档中有一条警告:
警告:如果您的域启用了 HTTPS 强制,GitHub Pages 的服务器将不会自动路由重定向。您必须通过域名注册商配置 www 子域和根域重定向。
我不知道如何解决这个问题。我怀疑这是问题的可能原因。因此,解决方案可能是绕过此重定向,我只是不知道如何做到这一点。