Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

How to use CDN to accelerate website optimization?

doWebsite optimizationWe often hear website acceleration, and every website wants to be accelerated. There are many ways to accelerate. Cache, memory, bandwidth, CDN, etc. deal with the acceleration of dynamic and static data respectively. In this article, we will talk about how to use CDN to accelerate.

What is CDN?

Wikipedia tells us:

CDN (Content Delivery Network) refers to a content distribution network, which uses various cache servers to distribute these cache servers to areas or networks where user access is relatively concentrated. When users visit a website, the global load technology is used to direct the user's access to the distance. On the nearest working cache server, the cache server directly responds to user requests.

CDN requires a large number of servers to be deployed on different nodes. Therefore, at this time, it is necessary to use the services of third-party server companies, such as CDN services of Alibaba Cloud, Tencent Cloud, Baidu Cloud, Huawei Cloud, Western Digital and other companies.pass throughThe CDN service accelerates static resource files such as images, CSS and JS.

How to use a third-party CDN service?

For direct use, for example, to apply for Alibaba Cloud's CDN service directly, and follow the instructions to resolve the CNAME of the domain name.

  • Normal non-CDN path: domain name - resolve to -> website server IP address
  • CDN path: domain name - resolve to -> third-party CDN domain name - configure back-to-source to -> website server IP address

As for using the commonly used CDN acceleration (static data), or using the full-site acceleration (static + dynamic), use them according to your own situation.

How to use third-party cloud storage and CDN services?

Regardless of dynamic content or static resources, CDN services are provided, and your dynamic content is generated in real time by PHP. The CDN acceleration effect needs to be tested due to different third-party platform services. In addition, pictures and other resources still have problems such as back-to-source or cannot use thumbnails .
Workaround solution: Mirror static resources to third-party cloud storage services, such as Alibaba Cloud's OSS and Tencent Cloud's COS, and then use a third-party CDN to accelerate static resources.
What are the benefits of using cloud storage?

  1. The image can be cropped in real time, we do not need the cropping function of the CMS, and can achieve different thumbnail sizes on different pages.
  2. The back-to-source operation of CDN is for cloud storage. As long as our static resources are mirrored to cloud storage, we can no longer store these resources locally (but there will be information displayed that the domain name points to third-party storage).

 OSS accelerates static resources with CDN

1. First register with Alibaba Cloud;
2. Then start the Alibaba Cloud OSS service.Click the "New Bucket" button under the Bucket Management on the right to create a new storage space;
Region: Choose the most based on where your website users are.
The following three options must be selected as follows:
Storage Type: SelectStandard storage.
Read and write permissions: selectpublic read.
Server-side encryption: select.
Other options, set according to your own needs, generally choose to close without special needs.
3. Create a bucket, select the storage space, and click "Basic Settings",choose"Mirror back to source” in this column, click Settings, and finally click Add Rule:
Back to source type: selectMirror
Back to source condition: selectHTTP status code 404
Back to source address: same as the picture above,Enter your blog address, www.mgsh.com.cn
4. After setting "Mirror back to source", go back and click "Transmission management"choose"Domain Name Management”, click “Bind User Domain Name”:
cnd.mgsh.com.cn
5. Then set the domain name CNAME as required
cnd.mgsh.com.cn
6. Click the "Not Configured" link under Alibaba Cloud CDN Acceleration to configure CDN:
cnd.mgsh.com.cn
You can select the OSS domain name for the origin site information, and configure the others according to your needs.
7. If you want faster cache efficiency, you can set the CDN cache expiration time:
File extension
8. In this way, the settings in Alibaba Cloud are completed. Go back to the CMS to configure the link between the CMS and OSS. CDN domain name: Enter the domain name set above, for example: cdn.mgsh.com.cn
That's it.

About CND related fees

First of all, buy as much as you want, otherwise, Ali's refund policy will make you unable to find North if you have a small balance.
CDN (Content Delivery Network) will distribute hotspot data stored by OSS to nodes across the country. When users access, they only need to visit the nearest CDN node to read files. Hotspot data does not need to access OSS source files, nor consume OSS external resources. This can not only improve the access speed and experience of your edge users, but also the external network traffic cost of CDN is lower than that of OSS external network traffic, which can effectively save the network traffic cost of your overall application.
The main costs include:

  • Storage Fee: Average monthly price of a storage package
  • Traffic cost: CDN back-to-source and outgoing traffic, CDN public network traffic cost
  • Number of requests: Put request + Get request summary

If you buy a 12G storage package for 100 months, the back-to-source traffic of CDN is 100G per month, 1200G per year, and the back-to-source requests are 10 times per month and 120 million times a year (according to the user's popularity, the back-to-source traffic and The number of requests will be less), CDN public network 200GB per month, 2400G per year,

Types of pay-as-you-go buy resource packs
OSS storage fee 0.12 yuan/GBx100x12
= 144 yuan/year
Purchase 100G resource pack:
99 yuan/year
OSS+CDN back-to-source traffic fee RMB 0.15/GB x 1200GB
= 180 yuan/year
Purchase 1TB resource pack:
156 + 0.15 x 176 = 182.4
The resource pack is even more expensive, am I wrong?
OSS+CDN back-to-source request fee 0.01 yuan/120 times x XNUMX million
= 1.2 yuan/year
No resource pack
CDN public network traffic cost RMB 0.24/GB x 2400GB
= 576 yuan/year
Purchase 2TB resource pack:
162 x 2 + 0.24 x 400 = 420

Extended reading:
How does the website achieve dynamic and static acceleration?
How to realize the dynamic and static separation of pictures JS, etc. through Ali OSS-bucket?
How can a website be accelerated using CDN?
How to Get Started Optimizing Your Website in Five Minutes Using the Beginner's Guide to SEO?

Back to Top