This is the 20th day of my participation in the August More Text Challenge

Hexo suffers from slow loading when using Github Pages. Many CDN platforms in China can provide accelerated services for websites. Due to random reasons, qiuniuyun is selected, which can generate SSL certificates for free and 10G of HTTP traffic for free. But the relevant online tutorial is not friendly, it took a lot of time to finally succeed, here I will record the process for future generations reference.

Requirements describe

My current situation and needs:

  • The domain name zywvvd.com has been applied for
  • The server is Github
  • Zywvd.github. IO is in use
  • Hexo has been mounted to www.zywvvd.com
  • Need: Qiniuyun CDN speed up site so that users can visit www.zywvvd.com quickly and get redirected to my Hexo home page

Content Delivery Network (CDN) acceleration principle

The cause of slow access to Github Pages

  • The server is abroad and data exchange is difficult
  • Objective factors cannot be changed, but we still require fast domestic visits

Principle of CDN

  • Domestic set up a number of servers for caching static pages
  • Create a cache to point to foreign sites and cache them to domestic servers
  • Generate a CANME to the domestic cache (alias of the IP address)
  • The domain name to be accelerated is resolved to the above CANME to achieve the acceleration of the domain name access

The relevant data

  • Web log 1: www.webkaka.com/Ping.aspx

  • Speed measurement website 2: www.17ce.com/

  • Tutorial 1: Hexo enables CDN accelerated access

  • Tutorial 2: Hexo+Next uses CDN to speed up websites and static files

  • Tutorial 3: Use CDN to speed up your blog

The preparatory work

  • Hexo was successfully built and mounted on the Internet
  • I have applied for and filed my domain name and successfully bound Hexo site
  • Apply for a Qiniu Cloud account

Accelerate the tutorial

Positive start

Re-resolve the site to other secondary domain names

The others here are contrasted with the prefix WWW.

Yes, because I want visitors to access my site through the domain name www.zywvvd.com, that is to say, this is the domain NAME I need to speed up. I can no longer resolve this domain name directly to our Hexo site, but I still need a secondary domain name pointing to him, so I need to bind the Hexo site to another secondary domain name. I used zzz.zywvvd.com/

At this point my site can be accessed at zzz.zywvvd.com/, but still at the original tortoise speed

Application for FREE SSL Certificate (optional)

SSL certificate is used for domain name to support HTTPS protocol. Qiniuyun provides 10G free traffic per month under HTTP protocol, but I cannot access the site without HTTPS, so I applied for the certificate, which requires 0.28 yuan /GB per month for traffic. A few yuan per month is enough for me.

It is recommended to apply for a certificate in advance. If you apply for a domain name starting with WWW, it will prompt you that you do not support a domain name starting with WWW. However, you can apply for a domain name directly.

  • Enter the qiuniuyun console and select SSL Certificate service:

  • Buy a certificate (don’t panic, it’s free)

  • Select the TrustAsia DV domain name type

  • Click check information and pay to confirm payment

  • Click to complete the information, and fill in the site domain name, remarks, corporate and personal information (information for this registration only)

  • After the submission, DNS authentication is required. Set the specified secondary domain name in the level-1 domain name, set the record type to TXT, and fill in the specified value for the host record. The verification will be successful in a short time

  • Wait a while and the issue will be successful

Add the test file in Hexo

  • The test file is just any little file in the Hexo/ Source folder

  • Hexo g, hexo d can access zywvvd. After making the IO/test. The HTML view

Add a CDN accelerated domain name

  • 7 Niuyun console, CDN, select Domain name management, add domain name

  • Select the normal domain name fill in the domain name you want to speed up (need to record) select the communication protocol HTTPS (I failed with HTTP)

  • Point!!

Coverage: Set according to individual needs

Usage scenario: Dynamic acceleration

Source site: Set the source site to the secondary domain name distributed by Github

Back to source Host: fill in the secondary domain we moved before, for example, mine was zzz.zywvvd.com/

Source site Tests: Fill in the test.html and click Test

  • Others are configured based on personal requirements. The default domain name is ok if there is no special requirement. After a while, a message is displayed indicating that the accelerated domain name is successfully established

Add 7 Niuyun CNAME resolution

  • When you configure the domain name, the system prompts you to configure the CNAME

  • Return to domain name management, copy CNAME

  • Add the accelerated prefix to the domain name dealer to resolve to the above CNAME

test

At this point we are done:

  • Accelerated domain → Qiuniuyun CNAME → Alternate secondary domain → Gtihub secondary domain → Site server

You can use dig command to test, see qiniuyun CNAME resolution can be:

dig www.zywvvd.com
Copy the code

Of course, the most practical or speed measurement

Comfortable…