Example of CDN and WordPress site integration via W3 Total Cache plugin
Example of CDN and WordPress site integration via W3 Total Cache plugin
For your information
These are instructions for connecting a CDN to a WordPress site via the Selectel provider and the W3 Total Cache plugin.
- Create a CDN resource.
- Create a personalized domain for the CDN resource.
- Add a personal domain to a CDN resource.
- Configure the W3 Total Cache plugin.
- Check the CDN resource.
Create a CDN resource
- In control panel 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 content source — the domain of your site on WordPress, 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 panel 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 panel under CDN → CDN resources → resource page → tab General. Specify the domain without the protocol.
Add a personal domain to a CDN resource
- In control panel 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.
Customize the W3 Total Cache plugin
- Navigate to the WordPress admin console.
- In the left menu, go to Plagins.
- In the search box, type
W3 Total Cache
. - In the search results in the W3 Total Cache plugin card, click Install Now → Activate.
- In the left menu, go to Performance → General Settings.
- In the block CDN check the box Enable.
- In the block CDN in the field CDN Type select Generic Mirror.
- In the block CDN click Save all settings.
- In the left menu, go to Perfomance → CDN.
- In the block Configuration in the field SSL support select Auto (determine connection type automatically).
- In the block Configuration in the field Replace site's hostname with enter the domain that added to the CDN resource as a personalized. Personal domain can be viewed in control panel: section CDN → CDN resources → CDN resource page → tab General → block Personal domains.
- Click Save all settings.
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 WordPress site 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.