WordPress knowledge sharing

Tencent Cloud COS Object Storage WordPress Plug in Installation Setting Detailed Graphic Tutorial

Tencent Cloud COS object storage can be used as static and dynamic separation of websites, allowing the server to run dynamic programs and run faster; The COS side processes static files, which can cooperate with each other to save resources on the server side and process more data under limited configuration conditions, indirectly realizing the purpose of cost saving. In this article, Weieisi Blog explains the installation and setting of WordPress plug-in for Tencent Cloud COS object storage in the wordpress website. The nouns and operations involved in this are more complicated, and there are more steps. It is not easy for new students to learn, so the content will be written in more detail.

The official version of Tencent Cloud COS plug-in has been launched. Please see Tencent Cloud Object Storage (COS) Plug in Installation and Setting Tutorial , Lao Wei suggested that everyone use official plug-ins, which would be better in all aspects.

I wrote an article before Tencent Cloud COS object storage WordPress plug-in makes the website run faster , which recorded the whole process of Tencent Cloud COS plug-in developed last time with Shuilengmou and Shen Huaizhi. After a lot of trouble, the original author was also contacted for help. Because of lack of experience in the first time, it failed finally. At the end of the article, Lao Wei said that the theme might not be compatible with the plug-in. Now, the problem is Lao Wei's improper operation. After five months, under the prompt of group friends @ political history, now Old Wei has reinvented the cool eyes of Tencent Cloud COS plug-in, and with some guidance from Tencent Cloud customer service, he finally successfully put the static picture on Tencent Cloud COS and the website can be displayed normally. Because this process is quite complicated, and it is unclear after a mistake. So you must be careful when you operate. If you follow the steps of Lao Wei, you will succeed.

If you use AliCloud server+OSS object storage, please go to Enable the detailed process of dynamic and static image text separation of AliCloud OSS object storage website

Send a notice before tossing, Weiaisi Blog reminds you: thousands of data, safety first, website not backup, webmaster two lines of tears!

Backup, backup, backup, important things three times!

If you are a novice, do not directly test in the production environment. It is recommended to open a new server and use the traffic billing method. Learn about it first, spend a few dollars, and operate the production environment after becoming proficient.

Selected explosives area
Selected preferential activities Click to view the purchase
Tencent Cloud Preferential Products Zone Click to view the purchase
Cross border e-commerce store server Lightweight application server
Tencent Cloud Animal Palu Game Server Click to view the purchase
For more Tencent Cloud content, please see Tencent Cloud

1、 What is object storage

Tencent Cloud is called COS, and Alibaba Cloud calls it OSS, which means the same thing. It is to put the static files of the website, such as pictures and documents, in the object storage space. Compared with the dynamic files such as asp, php and jsp, these contents will not change for a relatively long time. Separate dynamic and static content. The cloud server is dedicated to running dynamic content, and the object storage is dedicated to running static content, so that the website runs more smoothly, opens faster, and indirectly saves costs.

Users who use COS standard object storage in mainland China can enjoy a certain amount of free storage space, free traffic, and free requests every month. During billing, priority shall be given to deduction of the free amount, and post payment settlement shall be carried out for the excess amount.

Resource Type Resource Subtype Monthly free quota
storage space storage space 50 GB
flow External network downlink traffic 10 GB
flow Tencent Cloud CDN back to source traffic 10 GB
request Read request 1 million times
request Write request 1 million times

Small sites like personal blogs are enough. Old Wei used them to store blog pictures in this article, and the dynamic and static separation will reduce the pressure on the ECS.

Tencent cloud object storage COS resource package is characterized by high scalability, low cost, reliability and security, and provides professional data storage services

Standard storage capacity Archive storage capacity
Suitable for anytime access, maintenance free, mass storage It is suitable for long-term storage of massive data and low frequency access scenarios
100G/123.24 yuan/12 months 100G/38.02 yuan/12 months
Click me to buy at a discount    Original price: 156 yuan Click me to buy at a discount   Original price: 39.6 yuan

It is strongly recommended that you use Tencent ECS with Tencent Cloud COS, which is simple and fast, time-saving, labor-saving and error free.

The following are the most popular S2 standard configurations of Tencent Cloud, and the bandwidth can be 1M/2M/5M/10M. Because this is a 30% discount price for Tencent Cloud's activities, and the cost performance ratio is very high, so Lao Wei recommends that you choose according to your business needs.

CPU: 1 core
Memory: 1G
Hard disk: 50GB
Bandwidth: 1Mbps
Flow: unlimited
Location: Beijing/Shanghai/Guangzhou
Price: 1144.8 yuan/3 years
About 31.8 yuan/month and 1717.2 yuan/month
Purchase: Click Direct
CPU: 1 core
Memory: 2G
Hard disk: 50GB
Bandwidth: 1Mbps
Flow: unlimited
Location: Beijing/Shanghai/Guangzhou
Price: 1535.04 yuan/3 years
About 42.64 yuan/month, saving 2302.56 yuan
Purchase: Click Direct
CPU: 2 cores
Memory: 4G
Hard disk: 50GB
Bandwidth: 1Mbps
Flow: unlimited
Location: Beijing/Shanghai/Guangzhou
Price: 3117.6 yuan/3 years
About 86.6 yuan/month, 4676.4 yuan/month
Purchase: Click Direct   <<Recommended purchase

For ECS with the same configuration, the price of Tencent Cloud is almost the same as that of Alibaba Cloud. If there is an event, Tencent Cloud will offer a better price. Moreover, both new and old users can participate in Tencent Cloud's activities, which is also different from Alibaba Cloud.

Please move to for more activities Summary of Tencent Cloud Long term Activities and Preferential Products , updated irregularly.

2、 Buckets and API keys

1. Search the object storage in the background of Tencent Cloud, create a bucket after entering, and select the standard storage type.

Write a name that is easy to distinguish, such as related to the domain name.

If the region you belong to is in the same region as your ECS, the access permissions are public read and private write. For example, if the server and COS are in Tencent Cloud Beijing, the intranet traffic is free. If you use Alibaba Cloud Server+Tencent Cloud COS in different regions, you will be charged.

The erased part in the figure is a string of numbers. Each bucket will allocate such a unique number for program identification.

2. The following series of actions need to be recorded to the local computer for backup, and can't be confused or lost.

APP ID settings: found in the cloud key API management.

SecretID and secretKey: randomly generated, which will be used later when copied.

These two strings of keys have very high permissions and are very important. Don't send them to others on the network.

The bucket name in the bucket list, also called Bucket, belongs to the region, which is also used later.

3、 Upload website image

The client tool seen in the above figure can be downloaded from the COSBrowser desktop after clicking Open. There are two versions, Windows and Mac. Login is to use the secretID and secretKey recorded above.

After logging in, you can see the newly created bucket. Create two new folders, wp content, and create uploads under them. The attributes are inherited. This is exactly the same as the wordpress image file path of the source server.

Download all the website images of the source server (the image path is under/wp content/uploads/) to the local, and then upload them to Tencent Cloud COS using this COSBrowser.

At this time, go to the object storage console on the web side, and you will see several folders similar to the one in the following figure, where all the images of the website you just uploaded are stored.

Many students understand that no matter how many pictures have been uploaded before, they have all been uploaded to COS. We establish the same image storage path on COS as the source server, and use plug-ins to call COS images to achieve dynamic and static separation.

4、 Bucket settings

1. Basic Settings>>The back to source address of the back to source setting is the main domain name or server IP of your website.

2. Domain name management>>custom acceleration domain name

For example, if Lao Wei uses img.vpss.net as the domain name prefix of the image, then click Add Domain Name in the figure below to add img. Do not change anything else, just save it directly. You can customize the prefix, such as img, tupian, etc., if you can understand it yourself, but the simplest way to understand it is to use img.

The domain name prefix img and img.vpss.net.cdn.dnsv1.com are recorded and used later.

5、 Add domain name resolution and set CDN

1. Open domain name management and add CNAME records. If the DNS record has not been modified, go to the website to buy the domain name; If you have modified the DNS management of your domain name, go to the modified one.

Fill in the domain name (img only) and record value (CNAME in the figure above) obtained above. The record type is CNAME, and save them.

2. Lao Wei uses DNSPOD and Tencent Cloud CDN, both of which are products. When he opens Tencent Cloud CDN, he sees that two COS domain names have been automatically added. If your domain name DNS management and CDN acceleration are not the same, you need to manually add them here.

Img.vpss.net is the custom domain name added above, which is used for pictures placed in COS. In Management>>Advanced Configuration, you can add or not add an SSL certificate for this domain name. In general, SSL certificates have many benefits. The SSL certificate of this secondary domain name should be applied for separately, and Tencent Cloud will provide a free one-year SSL certificate.

The following domain name is automatically added by the system. No configuration is required.

3. CDN acceleration related details

Dynamic websites on the server side use CDN acceleration, and static files on the COS side also use CDN acceleration. The CDN acceleration of these two parts can not be placed in the same home. For example, my website can use Tencent Cloud CDN for acceleration, and object storage can use Qiniu Cloud/Youpai Cloud/Alibaba Cloud. That requires manual settings, which is troublesome for new students and requires extra payment.

The advantage of using the same CDN acceleration and object storage is that many settings are automatically added and set in the background of the service provider, saving trouble. If you want to use it for learning, you can do it at different homes. Of course, I will become familiar with this process later. CDN acceleration and object storage can be placed anywhere.

6、 Setting process of Tencent Cloud COS synchronization plug-in (V5 SDK)

1. After everything is set, you can finally install the wordpress plug-in. The author of this plug-in is Shuilengmou (plug-in address: https://www.slmwp.com/cos-sync-plugins.html )。 Thank you for providing us with this practical plug-in.

The function of the plug-in is to connect your dynamic website with the static object storage, so that the files uploaded by the website and the files uploaded later will automatically call the object storage space. The plug-in will modify the file upload path in WordPress background settings>>Media.

2. Plug in settings are shown in the following figure. The relevant blank filling content can be found in Tencent Cloud background object storage.

Bucket setting: bucket name

Bucket region: the region to which the bucket belongs

The secretID and secretKey have been recorded.

Enable security certificate link: check if the website uses https, and uncheck if it doesn't use https.

Local folder: wp content/uploads

URL prefix: https://img.vpsss.net/wp-content/uploads In fact, it is the above custom domain name+local folder

Finally, click Update to save it.

The following two functions, "Synchronize History Attachment" and "Replace Article Media Link", can be used without using them. If you don't understand them and misuse them, you will bear the consequences.

7、 Batch replace picture URL

At this time, you can try to create a new article, upload pictures, and see if the picture URL in the media is similar https://img.vpsss.net/wp-content/uploads/ This form.

The following two plug-ins can be used to replace the image URL of previously published articles, whichever is appropriate.

WordPress batch replacement url plug-in Velvet Blues Update URLs installation

Search&Replace Plug in WordPress Find and Replace Website Link

After batch replacement, check whether the image addresses of the front-end web pages are correct. If you use the memcached cache and CDN acceleration, some image addresses may not be updated. Go to the CDN acceleration background to force a refresh.

In addition, if the draft is saved and the article is sent regularly, it will not be updated automatically. You need to manually modify the address.

So far, the whole work has been successfully completed. Finally, if the new students want to successfully solve this process, they should back up the data in advance. Whether Tencent Cloud, Alibaba Cloud or other object storage vendors, the process is similar. The writing process of this article took a lot of time. Actually, it didn't take much time to be proficient in the operation. But in order to write an article to reproduce the entire operation, we also need to take care of the acceptance of new students and pay attention to details. In order to reproduce the entire operation process, it will take several hours to write an article, which is quite hard. In any case, I hope this article can help you and share valuable content, which is also the purpose of establishing Weieis blog.

Like( seven )
Article name: Detailed Graphic and Text Tutorial of Tencent Cloud COS Object Storage WordPress Plug in Installation and Settings
Article link: https://www.vpsss.net/14112.html
Copyright notice: The resources of this website are only for personal learning and exchange, and are not allowed to be reproduced and used for commercial purposes, otherwise, legal issues will be borne by yourself.
The copyright of the pictures belongs to their respective creators, and the picture watermark is for the purpose of preventing unscrupulous people from stealing the fruits of labor.