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 through a Selectel provider with content distribution through a personal domain.
- Create a CDN resource.
- Create a personalized domain for the CDN resource.
- Add a personal domain to a CDN resource.
- Replace the domain in the URL of static files.
- Check the CDN resource.
Create a CDN resource
- В control panels go to CDN → CDN resources.
- Click Create a CDN resource.
- 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.
- Select a Selectel provider.
- Specify the source of content — the domain of your site, from where the CDN will take static files, for example
example.com
. - 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 CDN → CDN resources → resource page → tab General.
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 CDN personal domain for distributing content. -
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 CDN → CDN resources → resource page → tab General. Specify the domain without the protocol.
Add a personal domain to a CDN resource
- В control panels go to CDN → CDN resources.
- Open the CDN resource page → tab General.
- In the block Personal domains click Add domain.
- Specify the third-level domain that you set up as a personal.
- Click Connect.
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
which 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.
Check 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 download, check your CDN settings and Host header. - 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.