After you upload an object to a bucket in OSS, a URL is automatically generated for the object. You can use this URL to access the object in the bucket. To access an uploaded object by using a custom domain, you must bind the custom domain to the bucket where the object is stored and add a CNAME record that directs you to the Internet endpoint of the bucket.
|Console||Web application, which is intuitive and easy to use|
|PHP SDK||SDK demos in various languages|
- Custom domain: the domain that you buy from a DNS service provider.
- OSS endpoint or bucket endpoint: the domain that OSS assigns to your bucket. You can use this domain to access the resources in your bucket. To access an OSS bucket by using your user domain, you must bind the user domain to the OSS endpoint, that is, add a CNAME record to Alibaba Cloud Domain Name System (DNS).
- Alibaba Cloud CDN domain: The accelerating domain that Alibaba Cloud Content Delivery Network (CDN) assigns to your user domain. To use the CDN acceleration service to access the resources in your bucket, you must bind your user domain to a CDN accelerating domain, that is, add a CNAME record to Alibaba Cloud DNS.
- Auto CDN cache update: If you update an object in your bucket but cache duration of the object cached on the CDN node does not expire, users can only access the object that is not updated. In this case, you must manually update the object cache on the CDN node. To simplify operations, OSS provides the auto CDN cache update feature. After you enable this feature, all updates on the objects in your bucket are automatically synchronized to the CDN node. For more information, see Enable auto CDN cache update.
For example, user A has a website with the domain
img.abc.com, and the website contains an image with the URL of
http://img.abc.com/logo.png. For easier management, user A wants to redirect all requests for the image to OSS without modifying the code, that is, keep the URL of the image unchanged. In this case, user A can bind a custom domain. The process is as follows:
- User A creates a bucket named abc-img in OSS and uploads the image to the bucket.
- User A binds the custom domain
img.abc.comto abc-img in the OSS console.
img.abc.comis bound to abc-img, OSS maps the custom domain to the bucket.
- User A adds a CNAME rule on the DNS server to map
abc-img.oss-cn-hangzhou.aliyuncs.com, which is the OSS endpoint of abc-img.
- After receiving a request for
http://img.abc.com/logo.png, OSS redirects the request to abc-img based on the mapping relationship between
img.abc.comand abc-img. That is, users who access the image with the URL of
http://img.abc.com/logo.pngare redirected to the following URL:
The following table compares the access processes before and after user A binds the custom domain.
|Before user A binds the custom domain||After user A binds the custom domain|
- To set CDN acceleration, see Bind a CDN accelerating domain.
- To access OSS resources from a static Webpage, see Configure static website hosting and Tutorial: Use a custom domain to configure static website hosting.
- To access OSS resources through HTTPS, see Certificate hosting.