At present, more and more users prefer to store images and other attachments separately in third-party object cloud storage. This process can save a lot of disk space for the server, reduce the workload of file migration when the website moves, and independent cloud storage also avoids server bandwidth restrictions when accessing files, Therefore, it can reduce the cost of site construction/operation and maintenance and improve the access experience 。 For object cloud storage, we should be most familiar with AliCloud OSS. Here is a brief introduction to its configuration and usage on WordPress.
Create Bucket
Access the AliCloud console through the Products and Services>Storage and CDN>Object Storage OSS
Enter the OSS console and click Create Bucket
Click to create a storage space, as shown:
There are two main points to be noted:
1、 region
It is recommended to consider the nearby location of your server. If you use an AliCloud server, it is recommended to choose the same region as the server. This can save the cost of upload traffic through intranet interworking. At the same time, the upload speed is much faster.
2、 read-write permission
choice Public reading
In this way, the image can be accessed normally.
WordPress background OSS configuration
plug-in unit
OSS does not support WordPress by default, so it needs to be implemented through plug-ins. If we use the theme developed by WPCOM, we strongly recommend using OSS Upload
Plug ins. We have done compatibility testing and code analysis on several OSS plug-ins, OSS Upload
It is the only one with perfect functions Hook mount is reasonable WordPress OSS plug-in. Plug in download can go to the author page: //www.xiaomac.net/oss-upload.html Github project address: //github.com/xiaomac/oss-upload
to configure
Install Enable OSS Upload
After plug-in, enter Settings>OSS Upload
, follow the prompts to set plug-in options.
The following options need attention:
Access Key and Secret Key
Access Key
and Secret Key
You can log in to the Alibaba Cloud background to get it: click the avatar in the upper right corner of the Alibaba Cloud interface, and select accesskeys
, and then create the AccessKey, as shown in the figure:
Access link
Visit the link and fill in the Internet Bucket domain name
Address (need to add //
perhaps //
), if you bind your own domain name, you can fill in your own domain name address. If Upload Path
If the saved directory is set, the access link should also be followed by the same directory.
Upload endpoint
To upload an endpoint, it was mentioned above when creating a bucket. If it is an AliCloud server and you select the same region, you can fill in Intranet node
If not, fill in the Internet access address.
If you fill in here, you can click the Test it
Button. If the prompt is normal, it indicates that the docking is successful.
thumbnail
Suggested choice Use parameter image service, default and simple
perhaps Use physical thumbnails, check if there is a thumbnail error in the theme
Option.
Remote Pictures
Themes also have similar functions (theme settings>optimization and acceleration>saving remote pictures). If the theme is enabled, it does not need to be enabled repeatedly.
Local Backup
It is recommended to check, especially in the process of early configuration and file synchronization, to avoid the problem of irrecoverable picture loss.
other Featured pictures
、 Style Separator
、 Full picture style
、 Automatic compression
、 Lazy loading
、 Delayed link
And other options can be ignored.
Click after setting Save Changes
Button, and then click Upload the entire local storage directory
To synchronize files to OSS, this process may take some time. After synchronization, you can visit the website's foreground page to test whether the images can be accessed normally. If so, it means that the configuration is successful.