Alibaba Cloud Object Storage Service (OSS) can be used for all kinds of static resources. In this article, we will discuss how to apply OSS resources to a website and examine why a website may fail to be accessed after OSS has been applied.
A user can store static resources, such as images, documents, and multimedia files, on OSS and bind a custom domain name to an OSS bucket.
Bind custom domain name to OSS: OSS domain name binding
For example, if the user's website is www.a.com and it contains a static resource 1.jpg , the user can store 1.jpg on the OSS bucket and bind the domain name oss.a.com to the bucket. The previous URL link for www.a.com was www.a.com/1.jpg, but now it can be changed to oss.a.com/1.jpg. If everything is done correctly, the OSS resource will be available on the website.
There are a few options to migrate static resources to OSS.
1) Iterate over each static resource you wish to migrate and call the putObject method in the SDK to upload them to the OSS: SDK object upload
Note: This requires prior knowledge in programming
2) Call ossimport to migrate. This requires a Java development environment and ossimport tool. The tool itself is quite simple. See OSSimport data migration tool
3) Search for third-party client tools in the Alibaba Cloud Marketplace to migrate your data
After successfully uploading your resources, if the bucket is Public-Read, the user can access the object through URL like so: bucketname.oss-cn-hangzhou.aliyuncs.com/objectname;
You can also obtain the URL link of the object through OSS Console. Go to the specific bucket, find your object, select Object Management, and click Obtain Address.
Another option is to obtain the URL through the SDK.
Obtain a signed URL: Obtain signed URL through the SDK
Obtain an unsigned URL: Obtain unsigned URL through the SDK
1) This website integrates an OSS WEB direct transfer demo for directly transferring resources from website to OSS, see direct resource transfer from website to OSS
2) This website integrates OSS Javascript SDK for directly transferring resources from website to OSS, see apply OSS in Javascript browser
3) Use the OSSFTP tool to apply bucket resources, see OSSFTPserver deployment
First invoke a server to deploy the OSSFTP server, and the FileZilla client to connect to the FTP server. After successfully testing the link, configure FTP for the website, then connect to the OSSFTP server and OSS
For Discuz configuration, see Discuz configuration
For PHPwind configuration, see PHPwind configuration
For WordPress configuration, see WordPress configuration
Check if the website domain name is bound to the bucket on your console. Go to Console > OSS > Specific_Bucket_Name > Domain Name Management.
Cause: An application's domain name originally had either an A record or CNAME record. After binding the bucket, as the domain name CNAME now redirects to the bucket's external address, it no longer points to the original service, which leads to failed requests to the original website.
Solution: Unbind the website domain name from the bucket and use a sub-domain name to bind to the bucket (make sure that the sub-domain name is not open to external services), for example oss.a.com or any other sub domain name.
Return the A record /CNAME record of the website domain name from the domain name server to the original website, and bind oss.a.com to the external address of the bucket.
Uptime & monitoring strategies for cloud - eCommerce apps/websites
2,599 posts | 758 followers
FollowAlibaba Clouder - June 2, 2020
Alibaba Clouder - July 29, 2020
Alibaba Developer - February 1, 2021
Alibaba Clouder - November 12, 2018
Alibaba Clouder - November 10, 2020
Alibaba Clouder - February 3, 2021
2,599 posts | 758 followers
FollowAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreProvides scalable, distributed, and high-performance block storage and object storage services in a software-defined manner.
Learn MorePlan and optimize your storage budget with flexible storage services
Learn MoreA cost-effective, efficient and easy-to-manage hybrid cloud storage solution.
Learn MoreMore Posts by Alibaba Clouder