Prepare

  • Register a account on CloudFlare and buy a domain.
  • Make sure you have created your Blog on Github Page. If you haven’t started a Blog yet, check out the previous post.

CloudFlare

  • Goto your domain.
    01
  • Goto DNS page.
    02
  • Add two record, A & CNAME
    03
    The Name in A is your domain name (xxx.com). The Content in A is your Github Page’s IP, and you can open cmd and enter ping to get the IP.
    04
    The Name in CNAME is www. The Content in CNAME is your Github Page.
  • Goto SSL/TLS > Edge Certificates page, and check Always Use HTTPS
    05

Github Page

  • Goto Setting > Pages, and enter your domain in Custom domain and Save.
    06

Final

  • Open the Blog folder and goto the source folder.
    07
  • Create a CNAME file under the source folder.
    08
  • As shown, enter your domain name.
    09
  • Finally, hexo g and hexo d were re-uploaded to Github.