Host a Static Website Using Alibaba Cloud OSS – Bucket
You can use Alibaba Cloud to host websites comprised of static or rarely changing content (including client-side scripts such as HTML, CSS and JavaScript).
Host your static website – Use Alibaba Cloud Object Storage Service (OSS) to host your static website. You will save your files to Alibaba Cloud OSS which will then provide content to visitors to your site.
Host the static website on Alibaba Cloud, first must complete the following operations:
1. Create a bucket where you will store your website’s files such as images, scripts, and videos.
2.Bind your custom domain name
Select Bucket > Select Domain Names.
Add a domain name> Click Submit
Select the automatic or manual adding method based on your domain name.
If the domain name meets the following conditions, you can select the automatic adding method.
●The domain name is to be resolved by Alibaba Cloud DNS with this account. The system will automatically add the corresponding CNAME record in the Alibaba Cloud DNS.
●This domain name has not been resolved in Alibaba Cloud DNS: The system will automatically add the corresponding CNAME record in the Alibaba Cloud DNS. However, you must change the domain name’s DNS to Alibaba Cloud DNS.
If the domain name has already been resolved in the Alibaba Cloud DNS of another account, you can only select the manual adding method.
– You can bind a custom domain name to your bucket. This allows you to seamlessly move your storage space to OSS.
3. Upload your files to your bucket.
You can upload any type of file to your bucket. you can only upload files smaller than 500 MB. If the file you want to upload is larger than 500 MB, refer to Upload files.
4.Set your bucket to static website hosting mode
Select Bucket > Click Basic Settings> Configure the Static Pages> Save
You can use the console to convert your bucket configuration to static website hosting mode and access this static website through the bucket domain name.
The OSS provides two functions to help users manage static websites hosted on the OSS more easily:
●Index Document Support
The index document refers to the default index document (equivalent to index.html of the website) returned by the OSS when a user directly accesses the root domain name of the static website. If you have set a static website hosting mode for a bucket, you have to specify an index document.
●Error Document Support
The error document refers to the error page the OSS returns to a user if the HTTP 4XX error (the most typical error is 404 “NOT FOUNT”) occurs when the user accesses the static website. By specifying the error page, you can provide your users with appropriate error prompts.
Once you have completed the above operations, visitors will be able to access your site using a link in this format: http://oss-sample.oss-cn-hangzhou.aliyuncs.com/
, where oss-sample
is the name of your bucket, and oss-cn-hangzhou.aliyuncs
is your domain name.
Next, you can bind you custom domain name to your bucket and thereby seamlessly move your storage space to OSS. For example, if your domain name is my-domain.com
and all your images were previously located at http://img.my-domain.com/x.jpg
, after you move your storage to OSS and bind your custom domain name, the images can still be accessed at the original address.
Test Page