- Manage and Operate OSS – Overview
- Manage and Operate OSS – Concepts
- Manage and Operate OSS – Bucket Operations
- Manage and Operate OSS – Object Operations
- Manage and Operate OSS – Image Processing
- Manage and Operate oss – Web Hosting and monitoring
- Manage and Operate OSS – Security Features
- Manage and Operate OSS – Quiz
OSS Web Hosting and Monitoring
Static websites are websites in which all web pages consist of only static content, including scripts such as JavaScript code that can be run on the client. You can use the static website hosting feature to host your static website on an object storage service (OSS) bucket and use the endpoint of the bucket to access the website.
Static website hosting
You can call the PutBucketWebsite operation to configure static website hosting for a bucket and access the static website by using the custom domain name bound to the bucket.
OSS provides the following features to manage static websites hosted in OSS:
- Index document support
An index document links to a default index page returned by OSS when a user directly accesses the domain name of a static website. The index page functions similar to index.html. To configure static website hosting for your bucket, you must specify an index document.
- Error document support
An error document links to an error page returned by OSS if HTTP 4xx-related error messages such as 404 NOT FOUND occur when a user accesses a static website. By specifying an error document, you can provide users with specific error messages when a page is not found.
For example, if the default homepage is set to index.html, the default 404 page is set to error.html, the bucket is oss-sample, and the endpoint used to access the bucket is oss-cn-hangzhou.aliyuncs.com:
If Subfolder Homepage is disabled:
- When you access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/ and http://oss-sample.oss-cn-hangzhou.aliyuncs.com/directory/, you actually access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/index.html.
- If the object does not exist when you access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/object, OSS returns http://oss-sample.oss-cn-hangzhou.aliyuncs.com/error.html.
If Subfolder Homepage is enabled:
- When you access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/, you actually access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/index.html.
- When you access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/directory/, you actually access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/directory/index.html.
- If the object does not exist when you access http://oss-sample.oss-cn-hangzhou.aliyuncs.com/object, OSS returns information based on the specified subfolder 404 rules. The subfolder 404 rules are as follows:
- Redirect: the default rule that checks whether object/index document exists。
- NoSuckKey: the rule that returns the default 404 page. If the default 404 page does not exist, HTTP status code 404 is returned。
- Index: the rule that checks whether object/index document exists.
Detail analysis
- Static websites are websites where all web pages consist of only static content, including scripts such as JavaScript running on the client. OSS does not support content that needs to be processed by the server, such as PHP, JSP, and ASP.NET content.
- When you configure static website hosting for a bucket:
- The index document is required, whereas the error document is optional.
- If Subfolder Homepage is disabled, you must ensure that the index and error documents exist in the root folder, and the documents are readable.
- If Subfolder Homepage is enabled, you must ensure that the index document exists in both the root folder and the subfolder, the error document exists in the root folder, and these documents are readable.
Read More: https://www.alibabacloud.com/help/doc-detail/31872.htm