Example of connecting Selectel CDN to a website
Example of connecting Selectel CDN to a website
For your information
These are instructions for connecting a CDN to a site via a Selectel provider with content distribution via personal-domain.
- Create CDN-resource.
- Create a personal domain for the CDN resource.
- Add personal domain to CDN-resource.
- Replace domain in static-file URLs.
- Check CDN-resource.
1. Create a CDN resource
- In Control Panel, go to CDN → CDN Resources.
- Click Create CDN resource.
- Enter the name of the resource. The name has no effect on the resource settings and is only used in the control panel.
- Select a Selectel provider.
- Specify the content source — the domain of your site from where the CDN will take static files, for example,
example.com
. - Click Create CDN resource. The CDN provider will create a default domain from which to distribute content. You can view the default domain in control panel under CDN → CDN resources → resource page → General tab
2. Create a personal domain for CDN resource
-
Open your DNS hosting control panel.
-
Create a third-level domain, such as
cdn.example.com
. This domain will be used as a personal CDN domain for content distribution. -
Create a CNAME record:
- record type is CNAME;
- record name is a subdomain of the form
cdn.example.com
; - value is the default domain in
*.selcdn.net
format. You can view the domain in control panel under CDN → CDN resources → resource page → General tab. Specify the domain without the protocol.
3. Add a personal domain to the CDN resource
- In Control Panel, go to CDN → CDN Resources.
- Open the CDN resource page → General tab.
- In the Personal Domains block, click Add Domain.
- Specify the third-level domain that you created as a personal domain.
- Press 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 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 the CDN resource
- Make sure that at least 30 minutes have passed after all the settings — this time is necessary for the CDN resource to fully work.
- 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. - Open the file through the default domain using a link of the form
*.selcdn.net/images/image.png
. If the file does not load, check the CDN and Host header settings. - Open the file through your personal domain using a link of the form
cdn.example.com/images/image.png
. If the object does not load, check that the CNAME record you added when create-personal-domain is correct.