GitHub Pages:设置自定义域

编程入门 行业动态 更新时间:2024-10-28 00:20:30
本文介绍了GitHub Pages:设置自定义域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我在 GitHub 中设置并运行了一个组织页面,一切似乎都在运行……但我有点困惑.我想真正了解这个过程,因为 /ainc/" rel="noreferrer">Organization,但对于任何一个,您都需要将 www 的 CNAME 记录设置为 organization.github.io,而不是像 organization.github.io/project 这样的东西.不要更改 @ 的 A 记录(我的是 GoDaddy 的默认设置).

如果您想让您的 Apex 域 (example) 重定向到新的子域 (www.example),那么您可以指向您的 Apex到您的子域 对dig的看法:

I've got an organization page set up and running in GitHub and things seem to be working...but I'm a little confused. I'd like to actually understand the process since the GitHub Help article refers to taking advantage of their CDN and DoS services, so bear with me.

Step 1: Created CNAME file in repo with domain 'example'

Step 2: Grabbed IP from dig example.github.io +nostats +nocomments +nocmd

Step 3: Entered IP from Step 2 into the 'A' record (see image below)

I decided to stop here and see where it got me, and to my surprise it seems to have done the trick. The example.github.io domain correctly redirects to the example domain and displays the content from the repo.

However I was informed that after the DNS props, you can dig example and see the CNAME record pointing to example.github.io. I do not see this, and I dislike thinking that I didn't set things up correctly. Any thoughts/comments/tips welcome, thanks!

解决方案

In order to take advantage of the CDN and DoS services provided by GitHub Pages, you'll need to set up a Subdomain (eg www.example or blog.example) instead of an Apex domain (example).

From the GitHub Help page you referenced:

If you are using an apex domain (example) instead of a subdomain (www.example) and your DNS provider does not support ALIAS records, then your only option is to use A records for your DNS. This will not give you the benefit of our Content Delivery Network.

Here's a setup (looks like you're using GoDaddy for DNS) that would work to get your Organization Pages working as desired:

This is actually for a Project Page within an Organization, but for either one, you'll set the CNAME record for www to organization.github.io, not something like organization.github.io/project. Don't change the A record for @ (mine is the default from GoDaddy).

If you want to get your Apex domain (example) to redirect to the new subdomain (www.example), then you can point your Apex to your subdomain with Domain Forwarding like this:

With that setup, you'll get to take advantage of GitHub's CDN, which you may notice is provided through fastly. Here's how my domain looks to dig:

这篇关于GitHub Pages:设置自定义域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 17:30:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/943850.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义域   GitHub   Pages

发布评论

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

>www.elefans.com

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