CDN: Quick start
You can manage CDN in the control panel.
-
Optional: add a personal domain to the CDN resource.
-
If your website runs on WordPress, integrate CDN and WordPress.
1. Create a CDN resource
A CDN resource is a set of settings that determine how content is fetched from the origin to CDN servers and delivered from CDN servers to end users.
The content origin is the location from which the CDN will request files. You can specify:
- your own origin;
- or an S3 bucket.
Own origin
S3
-
Ensure you have topped up your balance with 500 ₽.
-
In the control panel, on the top menu, click Products and select CDN.
-
Click Create CDN resource.
-
Select the content delivery optimization type. You can [change the optimization type](/cdn/content/content-delivery-optimization.mdx#change-optimization-type after creating the CDN resource.
- Static — suitable for delivering small files: images, video and audio files, text formats;
- or Large files — suitable for delivering large files without loss of quality, for example, video. Files are cached and delivered in parts (slices) using HTTP Range requests. By default, the slice size is 16 MB; you can change the slice size after creating the CDN resource.
-
In the Address field, enter the domain or IP address of your website.
-
Click Create. When you create a CDN resource, a default domain is automatically generated. Files that the CDN server will distribute will be accessible via a link in the format
*.selcdn.net. You can keep the default domain or add a custom domain.
2. Optional: add a personal domain to the CDN resource
We recommend distributing content through a personal domain. Using a third-party domain can make website promotion difficult and affect your search engine ranking.
- Register a domain.
- Create a CNAME record in DNS hosting.
- Add a personal domain in the control panel.
- Add an SSL certificate to the CDN resource.
- Replace the domain in the links on your website.
1. Register the domain
If you do not have a domain yet that you want to use as a personal domain, register one. You can register a domain in Selectel.
If you already have a domain, proceed to stage 2.
2. Create a CNAME record in DNS hosting
You can only use a subdomain of your main domain as a personal domain, for example cdn.example.com for example.com. You cannot use the main domain as a personal domain.
-
Open the resource record editor for the domain:
- if you have delegated the domain to Selectel, go to the Selectel Control Panel: in the top menu, click Products → DNS Hosting → the Domain zones;
- if the domain is managed in another DNS hosting service, open the control panel for that DNS hosting service.
-
Create a resource record. Specify:
-
record type — CNAME;
-
record name — a subdomain such as
cdn.example.com; -
value — a default domain in the format
*.selcdn.net. Specify the domain without the protocol, for examplecdn.example.com. Each domain level can be up to 63 characters long. The total length of all levels must not exceed 253 characters.You can view the default domain in the control panel: in the top menu, click Products → CDN → CDN resources section → the domain will be specified in the resource line.
-
3. Add a personal domain in the control panel
-
In the control panel, on the top menu, click Products and select CDN.
-
In the CDN Resources section, open the resource page → General tab.
-
In the Custom Domain block, click Add Custom Domain.
-
Specify the custom domain for which you configured the record in step 2. If you have a Cyrillic domain, first convert it to Punycode. For example, for
сдн.пример.рфyou need to specifyxn--d1ask.xn--e1afmkfd.xn--p1ai. You can use any Punycode converter — for example, at sweb.ru. -
Click Apply. While settings are being applied, the resource will have the
PROCESSINGstatus. You cannot apply other settings at this time. The settings will be applied once the resource enters theACTIVE.
4. Add an SSL certificate to the CDN resource
-
In the control panel, click Products in the top menu and select CDN.
-
Go to the CDN Resource Certificates section.
-
If you want to issue a Let's Encrypt certificate:
3.1. In the menu, select Issue Let's Encrypt certificate.
3.2. Select the CDN resource for which you want to issue a certificate.
3.3. Click Issue.
-
If you want to upload a custom certificate:
4.1. In the menu, select Upload custom certificate.
4.2. Specify a certificate name. It will only be used in the control panel.
4.3. Add the domain certificate. It must start with
-----BEGIN CERTIFICATE-----and end with-----END CERTIFICATE-----.You can add a certificate chain (main domain certificate, intermediate, and root) — make sure they form a complete chain. The
Issuervalue of the main certificate must match theSubjectvalue of the first intermediate certificate, theIssuervalue of the first intermediate certificate — with theSubjectvalue of the second intermediate, and so on.4.4. Add the private key. It must start with
-----BEGIN PRIVATE KEY-----and end with-----END PRIVATE KEY-----.4.5. Click Upload.
-
Go to the CDN Resources section.
-
Open the CDN resource page → Certificates tab.
-
Select the HTTPS delivery via CNAME checkbox.
-
In the Certificate field, select the certificate you issued in step 3 or uploaded in step 4.
-
Click Apply. While settings are being applied, the resource will be in
PROCESSINGstatus. You cannot apply other settings during this time. The settings will be applied once the resource switches toACTIVE.
5. Replace the domain in links on your website
If your website runs on WordPress, proceed to integrating CDN and WordPress.
If, when creating a resource in stage 1, you chose your own content source, replace the domain in the static file URLs on your website with the personal domain of the format cdn.example.com, which you specified in step 3 when creating a CNAME record in stage 2.
3. Integrate CDN and WordPress
If your website does not run on WordPress, proceed to checking the CDN resource status.
-
Go to the WordPress admin console.
-
In the left menu, go to the Plugins section.
-
In the search bar, enter the plugin name —
W3 Total Cache. -
In the search results, in the W3 Total Cache plugin card, click Install Now → Activate.
-
In the left menu, go to the Performance → General Settings section.
-
In the CDN block, select the Enable check box.
-
In the CDN block, in the CDN Type field, select Generic Mirror.
-
In the CDN block, click Save all settings.
-
In the left menu, go to the Performance → CDN section.
-
In the Configuration block, in the SSL support field, select Auto (determine connection type automatically).
-
In the Configuration block, in the Replace site's hostname with field, enter the CDN resource domain:
- if you did not add a personal domain to the CDN resource, specify the default domain that was automatically created when creating the resource;
- if you added a personal domain to the CDN resource, specify it.
You can view the default domain and personal domain in the control panel: on the top menu, click Products → CDN → CDN resources section → the resource row.
-
Click Save all settings.
4. Check the CDN resource
Own origin
S3
-
Wait for the CDN resource to become functional — it will switch to the
ACTIVEstatus. -
Open the file that the CDN should serve via a link on your website. Link example:
example.com/images/image.png. If the file does not open, check your website's operation. -
Open the file via the default domain using the link. Link example:
*.selcdn.net/images/image.png. If the file does not open, check the CDN resource settings and the Host header. -
If you added a custom domain in step 2, open the file via the custom domain using the link. Link example:
cdn.example.com/images/image.png. If the file does not open, check the correctness of the CNAME record you created in step 2.