Use Case: How to Set Up the Static Content Distribution
CDN resources are required to serve static content through geographically distributed servers of the Content Delivery Network (CDN). When a content request comes into the server, it first checks the CDN servers to see if the content is present and if it is absent, it checks the content source.
Follow these steps to configure the distribution of static content through the CDN:
Move site static content to a separate domain (such as
static.example.com— this will be the content source). If you use Cloud storage, creating a separate domain for the source is optional.
Create a CDN resource in the Control panel.
To work through the CDN, you can use a ready-made domain of the
85e77c09-bc03-43bf-b8f3-9492ae33390f.selcdn.netform or link your own domain, for example,
cdn.example.com. We recommend linking your own domain, as the use of third-party domains can have a negative effect on social media promotion and an order in the search results.
Configure your DNS Registrar’s CNAME record with
cdn.example.comto the domain of the CDN provider that the CDN provider allocates when connecting. A CNAME record is a type of DNS record that maps an alias name to a true (canonical) domain name.
For example, if you use CDN Selectel, a canonical domain name looks like
85e77c09-bc03-43bf-b8f3-9492ae33390f.selcdn.net, where 85e72c09-bc03-43bf-b8f3-9492ae33390f is generated automatically.
An example entry:
cdn.example.com in 85e77c09-bc03-43bf-b8f3-9492ae33390f.selcdn.net
You can check if the entry is correct in the Control panel on the Resource check tab, on your own by running the
digcommand in a terminal, or using online services. If you set the CNAME correctly, you will see an entry:
cdn.example.com 14399 IN CNAME 85e77c09-bc03-43bf-b8f3-9492ae33390f.selcdn.net
In your site settings, change the domain for the statics that you plan to serve through the CDN to
cdn.example.comor the default domain.
As a result, the user types the
www.example.com address, from which they receive the HTML page, in the browser line. In this case, all static content, for example, graphic images, is loaded from the CDN (from the
If the content has already been requested and cached on the CDN servers, users will download it from the nearest CDN server. If it is absent,
static.example.com will be contacted to upload the content to the CDN server.