Skip to main content
Connect CDN to the site
Last update:

Connect CDN to the site

For your information

These are instructions for connecting a Selectel CDN to a site with content distribution via personal domain.

  1. Create a CDN resource.
  2. Create a personalized domain for the CDN resource.
  3. Add a personal domain to a CDN resource.
  4. Replace the domain in the URL of static files.
  5. Check the CDN resource.

1. Create a CDN resource

  1. In control panel go to CDNCDN resources.
  2. Click Create a CDN resource.
  3. Enter a name for the resource. The name has no effect on the resource settings and is used only for operation in the control panel.
  4. In the block Content Source select Your source..
  5. In the field Domain or IP address specify the IP address or domain of your site.
  6. Click Create a CDN resource. CDN provider will create default domain From which the content will be distributed. You can view the default domain in control panels under CDNCDN resources → resource page → tab General.

2. Create a personal domain for the CDN resource

  1. Open your DNS hosting control panel.

  2. Create a third-level domain, such as, cdn.example.com. This domain will be used as CDN personal domain for distributing content.

  3. Create a CNAME record:

    • record type is CNAME;
    • record name is a subdomain of the form cdn.example.com;
    • value — default domain in the format *.selcdn.net. You can view the domain in control panels under CDNCDN resources → resource page → tab General. Specify the domain without the protocol.

3. Add a personal domain to a CDN resource

  1. В control panels go to CDNCDN resources.
  2. Open the CDN resource page → tab General.
  3. In the block Personal domains click Add domain.
  4. Specify the third-level domain that you set up as a personal.
  5. 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.comwhich added to the CDN resource:

  • if the site is on a CMS — use a plugin for URL replacement. For example, for a WordPress site use the W3 Total Cache plugin;
  • if the site is not on CMS — replace the URL in the site code.

5. Check CDN resource

  1. Make sure that at least 30 minutes have passed after all the settings — this time is necessary for the CDN resource to fully work.
  2. Open the file on the content source using a link of the form example.com/images/image.png. If the file doesn't load, the problem is on the side of your site.
  3. Open the file through the default domain using a link of the form *.selcdn.net/images/image.png. If the file does not download, check your CDN settings and Host header.
  4. Open the file through your personal domain using a link of the form cdn.example.com/images/image.png. If the object is not loaded, check if the CNAME record you added when you loaded the object is correct creating a personalized domain.