CDN: Quick start
You can work with CDN in the Control Panel and via the CDN API.
-
Optional: add a custom domain to the CDN resource.
-
If your website runs on WordPress, integrate CDN with WordPress.
1. Create a CDN resource
A CDN resource is a set of settings that determine how the CDN will retrieve content from the content origin and deliver it to end users.
The content origin can be:
- a custom origin — a server accessible from the Internet via HTTP or HTTPS;
- or an S3 bucket.
Custom origin
S3 bucket
-
Make sure you topped up your balance by 200 ₽. This is required to start the CDN resource creation process. The funds will remain on your balance.
-
In the control panel, in the top menu, click Products and select CDN.
-
Click Create resource.
-
Select the optimization type for content delivery:
-
static content — if you need to deliver web files via CDN that are used for website display: images, styles, scripts, small videos, text files (HTML, CSS, JS, and others);
-
or Large files (over 20 MB) — if you need to deliver long videos or files via CDN that users will download: distributions, archives, disk images. The CDN will download such files from the origin in parts rather than entirely. By default, the size of one part (slice) is 16 MB; you can change the slice size after creating the CDN resource.
You can change the optimization type after creating the CDN resource.
-
-
In the Address field, enter the domain or IP address of the content source.
-
Click Create. A default domain of the form
*.selcdn.netwill be generated for the CDN resource. You can keep the default domain or добавить персональный домен.
2. Optional: add a custom domain to the CDN resource
We recommend distributing content via a custom domain. Using third-party domains can complicate website promotion and affect search engine rankings.
- If you do not yet have a domain that you want to use as a custom domain, register a domain.
- Create a CNAME record in DNS hosting.
- Add a custom domain in the Control Panel.
- Add an SSL certificate to the CDN resource.
- Replace the domain in links on the website.
1. Register a domain
If you have a domain, go to step 2.
If you do not have a domain, register it with a domain registrar. You can register a domain in the .ru and .рф zones via the Domains service in Selectel.
2. Create a CNAME record in DNS hosting
Only a subdomain of the primary domain can be used as a custom domain, for example, cdn.example.com for example.com. You cannot use the primary domain as a custom domain.
-
Open the resource record editor for the domain:
- if you delegated the domain to Selectel, go to the Selectel control panel: in the top menu, click Products → DNS Hosting → Domain zones;
- if you delegated the domain to a third-party DNS hosting, go to the control panel of this DNS hosting.
-
Create a resource record. If you delegated the domain to Selectel, use the Add a resource record instructions. Specify:
-
record type — CNAME;
-
record name — a subdomain like
cdn.example.com; -
value — the default domain like
*.selcdn.net. Specify the domain without the protocol, for example,cdn.example.com. The allowed length of each domain level is 63 characters. The 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 → the domain will be specified in the CDN resource row.
-
3. Add a custom domain in the control panel
-
In the control panel, in 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.
-
Enter the custom domain for which you created a CNAME record in step 2. If you have a Cyrillic domain, convert it to Punycode first. For example, for
сдн.пример.рф, specifyxn--d1ask.xn--e1afmkfd.xn--p1ai. You can use any Punycode converter. -
Click Apply. While the settings are being applied, the resource will be in the
PROCESSINGstatus. During this time, applying other settings is unavailable. The settings will be applied when the resource status changes toACTIVE.
4. Add an SSL certificate to the CDN resource
-
In the Control panel, go to the top menu, click Products, and select CDN.
-
Go to Certificates for CDN resources.
-
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 the certificate name. The name will only be used in the control panel.
4.3. Add a 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 certificates) — 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 must match theSubjectof the second intermediate certificate, and so on.4.4. Add a private key. It must start with
-----BEGIN PRIVATE KEY-----and end with-----END PRIVATE KEY-----.4.5. Click Upload.
-
Go to CDN resources.
-
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 the settings are being applied, the resource will be in
PROCESSINGstatus. Applying other settings is unavailable during this time. The settings will take effect once the resource changes its status toACTIVE.
5. Replace the domain in links on the website
If your website runs on WordPress, integrate CDN with WordPress.
If you selected your own content source during resource creation in step 1, then in the URLs of the site's static files, replace the domain with a custom domain like cdn.example.com, which you specified in step 3 when creating the CNAME record in step 2.
3. Integrate CDN with WordPress
If your website does not run on WordPress, proceed to checking the CDN resource operation.
-
Go to the WordPress admin dashboard.
-
In the left menu, go to Plugins.
-
In the search bar, enter the plugin name —
W3 Total Cache. -
In the search results on the W3 Total Cache plugin card, click Install Now → Activate.
-
In the left menu, go to Performance → General Settings.
-
In the CDN block, select the Enable checkbox.
-
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 Perfomance → CDN.
-
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 custom domain to the CDN resource, specify the default domain that was automatically generated when creating the resource;
- if you added a custom domain to the CDN resource, specify it.
You can view the default domain and custom domain in the Control Panel: in the top menu, click Products → CDN → section CDN resources → CDN resource row.
-
Click Save all settings.
4. Check CDN resource operation
Custom origin
S3
-
Wait for the CDN resource to start working — it will switch to
ACTIVEstatus. This usually takes up to 30 minutes. -
Open the file that the CDN should serve using the link on your website. Example link:
example.com/images/image.png.If the file does not open, check the website operation.
-
Open the file via the default domain using a link, for example:
*.selcdn.net/images/image.png. You can view the default domain in the Control Panel: in the top menu, click Products → CDN → CDN resources → the CDN resource row shows the default domain like*.selcdn.net.If the file does not open, check the CDN resource and Host header settings.
-
If you added a custom domain in step 2, open the file via the custom domain using a link. Example link:
cdn.example.com/images/image.png.If the file does not open, check the correctness of the CNAME record that you created in step 2.