Connect CDN to the site
For your information
These are instructions for connecting a CDN to a site with content distribution via a personalized domain.
- Create a CDN resource.
- Create a personalized domain for the CDN resource.
- Add a personalized domain to the CDN resource.
- Replace the domain in the URL of the static files.
- Check the CDN resource.
1. Create a CDN resource
- In the Control Panel, on the top menu, click Products and select CDN.
- Click Create CDN resource.
- Enter the name of the resource.The name does not affect the resource settings and is used only for operation in the control panel.
- In the Content Source block, select Your Source.
- In the Domain or IP Address field, enter the IP address or domain of your site.
- Click Create CDN resource.The CDN provider will create a default domain from which the content will be distributed.You can view the default domain in the control panel: in the top menu, click Products → CDN → CDN Resources → CDN Resources → Resource page → General tab.
2. Create a personal domain for the CDN resource
-
Open your DNS hosting control panel.
-
Create a third-level domain, such as
cdn.example.com.
This domain will be used as your personal CDN domain for content distribution. -
Create a CNAME record.To do so, specify:
- record type is CNAME;
- record name is a subdomain of the form
cdn.example.com
; - value — default domain of the form
*.selcdn.net
.Specify a domain without a protocol.You can view the default domain in the control panel: in the top menu, click Products → CDN → CDN Resources → CDN Resources → Resource page → General tab.
3. Add a personal domain to a CDN resource
- In the Control Panel, on the top menu, click Products and select CDN.
- Open the CDN resource page → General tab.
- In the Personal Domains block, click Add Domain.
- Specify the third-level domain you created as your personal domain.
- Click Connect.
4. Replace domain in URLs of static files
In the URLs of your site's static files, replace the site domain with a personal domain of the form cdn.example.com
that you added to the CDN resource:
- If the site is on a CMS — use a plugin for URL replacement.For example, for a site on WordPress use the W3 Total Cache plugin;
- if the site is not on CMS — replace the URL in the site code.
5. Check CDN resource
- Wait for the CDN resource to work.Usually it takes at least 30 minutes after all settings have been made.
- Open the file on the content source using a link of the form
example.com/images/image.png
.If the file does not open, check the performance of your site. - Open the file through the default domain using a link of the form
*.selcdn.net/images/image.png
.If the file does not open, check the CDN and Host header settings. - Open the file through the personal domain using a link like
cdn.example.com/images/image.png
.If the file does not open, verify that the CNAME record you added when you created the personal domain is correct.