Store WordPress multimedia content to COS

Last updated: 2020-02-16 17:42:27

PDF

Note

WordPress can save multimedia content on Tencent Cloud COS through third-party plug-ins. Saving multimedia content on COS has the following benefits:

  • Multimedia content will have higher reliability.
  • Your server does not need to prepare additional storage space for multimedia content.
  • Visitors will be directly connected to the COS server when viewing and downloading multimedia content, which does not occupy your server's downstream bandwidth / Traffic, Access is faster.
  • It can cooperate with Tencent Cloud CDN to further improve the speed of viewing and downloading multimedia content.

Preparatory work

  1. Build WordPress.
  2. Create one Public read and private write The region recommendations of Bucket and Bucket are the same as those of CVM running WordPress. For more information on how to create them, please see Create Bucket Document.
  3. Find the newly created Bucket in the list of Bucket, record Bucket name and Region The geographical abbreviation of. For regional abbreviations, see Regions and Access Domain Names Document.
  1. Enter Access Management console To record the SecretID and SecretKey .

Install and configure the WordPress plug-in

  1. Log in and enter WordPress Instrument panel .
  2. In the left menu bar, select "plug-ins"-> "install plug-ins" to go to the install plug-ins page. Search and install here Media Cloud Plugin.
  1. Enable Media Cloud Plug-in, which automatically opens the configuration wizard, and then click [NEXT].

If the configuration wizard cannot be opened automatically, select [Media Cloud] from the left menu of WordPress, and click [Setup Wizard] under [Cloud Storage].

  1. Select [S3 Compatible] in the storage provider interface, and click [NEXT].
  2. Configure the following content in the subsequent form, and click "NEXT" when the configuration is complete:
Configuration ItemConfiguration value
ACCESS KEYAccess's keySecretID
SECRETAccess's keySecretKey
BUCKETBucket name
RegionSelectAutomatic
CUSTOM ENDPOINTThe format isCos..myqcloud.com, of which & lt;Region> is BucketRegionThe geographical abbreviation of. For example, if the region of Guangzhou is abbreviated as ap-guangzhou, the configuration item should be filled in.Cos.ap-guangzhou.myqcloud.com
6. At this point, Media Cloud will test whether the configuration is correct. Click "START TESTS" to start the test. After all the tests are successful, click "NEXT".7. If the Media Cloud prompt is ready, click [ADVANCED SETTINGS] to close the configuration wizard.

Test multimedia content

  1. Write articles, add multimedia content and publish.
  1. Copy the picture address in the article, or check the picture path through the browser debugging tool, you can see that the picture address is the address on Tencent Cloud COS Cloud Object Storage.
  2. Looking at the download address of the attachment to the article, you can see that the download address also points to the address on Tencent Cloud COS Cloud Object Storage.

Use Tencent Cloud CDN

  1. To configure CDN acceleration for Bucket saved in the WordPress attachment, see Setting CDN Acceleration Document.
  2. Go to the management interface of Media Cloud and click Cloud Storage [Settings] below.
  1. will CDN SETTINGS In CDN Base URL Set to your CDN domain name, such as the default accelerated domain name for COS https://wordpress-1250000000.file.myqcloud.com/ Or your custom accelerated domain name https://static.foo.bar/ .
  1. Check the multimedia content in publish's previous article and you can see that the relevant address already points to the CDN domain name you configured.