ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Net Web >

Typecho uses seven cows as CDN to cache image files

Wednesday on February 26th, 2020Net Web

We know that a lot of cyberspace is limited by traffic and bandwidth, especially in foreign space. The access speed is more worrying, which has spawned a lot of CDNs, that is, content distribution. At present, there are verycloud, qiniu, youpai cloud, Alibaba cloud, Tencent cloud, etc.

These CDN providers are generally HTTP free and HTTPS free. In order to save money, we only cache images, CSS, JS and other static files, which can reduce the cost of many servers.

Here's a brief introduction of how to cache blog images with qiniu:

(img.mrhe.net was used before, and this time, cdn.mrhe.net was used instead.)

Premise and notice:

1. You need to have a registered account in qiniu and pass the real name certification.

2. Make sure you have at least 10 yuan in your account.

3. The domain name you want to speed up must be registered with ICP (it is not allowed for the time being after the practice of public security registration)

Methods and steps:

1 Configure the SSL certificate.

Select SSL Certificate in the menu on the left. Generally, we can download the certificate in nginx format in Alibaba cloud (the application is successful in 5 minutes).

Choose to upload your own certificate, open it with EDITPLUS and other software, copy the PEM file content to the public key, and copy the key file content to the private key.

2 Bind domain name.

Seven cattle prompt: in the process of domain name creation, the longest time is 3 hours. During this period, the domain name functions such as cache configuration, modification of source station, anti-theft chain, deletion of domain name are not available, and the configuration is completed in about 30 minutes by personal test.

Create a new space and bind the domain name. If the SSL needs to choose the fusion CDN, the communication protocol needs to choose HTTPS. If only HTTP is needed, the traffic is free. While HTTPS traffic is not free, but for personal blogs, the charge is very low. Shududu's blog monthly expenditure is about 0.1-0.2 yuan, which can be almost ignored.

Then, according to the prompts, make the corresponding secondary domain name (such as CDN. Mrhe. Net) as CNAME to 7niu, and wait for it to take effect.

3 Set up image storage.

As shown in the figure, here is your blog attachment upload directory.

4 Blog settings

Open the post.php file, and

?php $this-content(); ?

Change to

In this way, every time we visit an article with an attachment, the attachment in it will be automatically stored in 7n space.

5 Precautions

1. Because HTTPS is charged, in order to prevent others from stealing your picture address, resulting in traffic loss, you need to set the anti-theft chain, as shown in the figure:

2. If you only need to cache static files, please select 7niu cloud storage in the source configuration.

3. If you need to cache static files such as CSS and JS, you can upload relevant files on the qiniu console, and then modify the corresponding reference address in the theme (generally head.php file).

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/netweb/Typecho-uses-seven-cows-as-CDN-to-cache-image-files.htm