×
Community Blog How to apply OSS resources to websites

How to apply OSS resources to websites

Alibaba Cloud Object Storage Service (OSS) can be used for all kinds of static resources. We will discuss how to apply OSS resources to a website and .

Redis_and_Memcached

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.

Applying OSS Resources to a Website

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.

How to Migrate Static Resources to OSS

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

How to Obtain the URL Link of an Object

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

Sending Newly Uploaded Resources on the Website to OSS

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

Troubleshooting Website Access Issues after Applying OSS

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.

0 0 0
Share on

Alibaba Clouder

2,599 posts | 758 followers

You may also like

Comments