cirry

cirry

我的原生博客地址:https://cirry.cn

Configure CDN service for Hexo

I often see service providers promoting CDN acceleration services, but I have never taken the time to set it up for my own website. Today, I have some free time to see what it's all about and whether it's useful.

First, let's spend some money. Tencent currently has a CDN discount promotion, and I spent ¥12 to get 100G/year.

After the purchase is complete, go to the Tencent Cloud Console -> Content Delivery Service -> Domain Management -> click on "Add Domain" to access the following page.

image

  • Select the correct acceleration region.

  • Acceleration domain: enter your own blog domain. You also need to add a DNS resolution for the domain. An example is shown below:
    image

  • Acceleration type: select CDN Web Small File.

  • IPv6 access can be left unchanged.

  • Project ownership can be left unchanged.

  • Tags can be left blank.

image

Origin server type: If your blog is hosted on a server, select "Own Origin".
Origin server protocol: Fill in according to the actual situation, whether the website is accessed via HTTP or HTTPS.
Origin server address: The IP address of the server where the blog is deployed.

The rest of the content can be configured as needed or skipped.

After returning to the domain management page, you can see that we already have a domain, but we still need to configure the CNAME for this domain.

image

In our domain resolution records, add another record, as shown below:

image

After waiting for DNS resolution to complete, our blog's CDN configuration is complete.

To check if our DNS configuration is successful, you can log in to ChinaZ.com, enter our blog website in the "Ping Test" section. If the returned results are similar to the following, with multiple IP addresses, it means our CDN is working properly.

image

If only one IP address appears, it means our CDN configuration was not successful. Please double-check the configuration.

Overall, this configuration is not very complicated, and the official website provides detailed scenario-based tutorials.

However, there is one issue. If a previously written article is modified and deployed, visitors may not be able to access the updated content and will continue to see the old page. This is because once the cache node hits the previous cached content, it will not request data from the source. Therefore, the node cache needs to be refreshed after we update our blog. Currently, I haven't seen any plugins related to this, but I may develop one myself in the future. For now, one solution is to make sure an article is as complete as possible before publishing it.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.