Custom Domain Github Pages

喜你入骨 提交于 2019-12-11 23:50:49

问题


So I've followed the directions for setting up a custom domain with Github Pages. As per their recommendation, I'm attempting to set this up using a custom subdomain.

I purchased my domain through GoDaddy, and using their DNS Manager tool I added myappname.github.io under Host (CNAME):

I didn't change anything else, such as that IP address under A (Host).

Lastly, on my Github page when I go under settings it correctly says "Your site is published under www.myappname.com"

Yet, when I go to www.myappname.com, I see the following:

What did I do wrong?

Edit:

Output from dig:

dig www.myappname.co

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

;; QUESTION SECTION:
;www.myappname.co.      IN  A

;; ANSWER SECTION:
www.myappname.co.   3600    IN  CNAME   myappname.github.io.
myappname.github.io.    3600    IN  CNAME   github.map.fastly.net.
github.map.fastly.net.  18  IN  A   199.27.76.133

;; Query time: 198 msec
;; SERVER: 10.2.0.4#53(10.2.0.4)
;; WHEN: Tue Mar 17 11:08:00 2015
;; MSG SIZE  rcvd: 120

回答1:


Your DNS is configured to redirect the www subdomain to your GitHub Pages site, but your GitHub Pages CNAME file specifies that your application should run on the apex domain, myappname.com. This causes another redirection to the apex domain, which as you point out in your question has its own A record pointing to a non-GitHub IP address.

As we discussed, one possible solution is to update the CNAME file in your repository to use www.myappname.com instead of myappname.com and then set up a redirect from the apex domain to the www subdomain.

This will cause requests to myappname.github.io and myappname.com to redirect to www.myappname.com, where your site lives.



来源:https://stackoverflow.com/questions/29099398/custom-domain-github-pages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!