This topic describes how to use a custom domain name to configure static website hosting.
Prerequisites
- You have registered a domain name of your own.
If you have not registered a domain name, you can use Alibaba Cloud Domains to register a domain name. For this tutorial, examplewebsite.com is used as the domain name. You can replace this domain name with your registered domain name.
- A bucket is created. The bucket ACL is set to public read.
For more information about how to create a bucket, see Create buckets. For this tutorial, the bucket is named originbucket.
Step 1: Upload web page objects
Before configuring static website hosting, you must upload two HTML objects as the homepage and the default 404 page. You must also add some objects for testing.
Step 2: Configure static website hosting
Step 3: Bind a custom domain name to an OSS bucket
Bind your custom domain name examplewebsite.com to your bucket. After the binding is complete, you can access the bucket by using your custom domain name, instead of the bucket domain name assigned by OSS.
- For more information, see Bind custom domain names.
- To improve upload and download speeds, or to enhance user experience for users located in remote geographic areas, we recommend that you enable OSS transfer acceleration and map the CNAME to an accelerate endpoint. For more information about how to bind an accelerate endpoint, see Bind accelerate endpoints.
Step 4: Test the website
To verify whether the website is running properly, open the following URLs in your browser:
URL | Result |
---|---|
http://examplewebsite.com | The default homepage of originbucket is displayed. |
The URL used to access an object in originbucket. Example: http://examplewebsite.com/123.jpg. | The content of 123.jpg is displayed. |
The URL used to access an object that does not exist in originbucket. Example: http://examplewebsite.com/abc. | The default 404 page of originbucket is displayed. |