You can configure static website hosting for a bucket by using the OSS console and access static websites by using the custom domain name bound to the bucket.

Background information

By specifying the default homepage and default 404 page of a bucket, you can have resources in the bucket displayed as static pages. We recommend that you bind a custom domain name to your bucket and use this custom domain name to access static websites. For more information about how to bind a custom domain name, see Bind custom domain names.
  • For security reasons, starting from August 13, 2018 for China regions, and September 25, 2019 for regions outside China, when you access OSS web page objects whose MIME type is TEXT or HTML and whose name extension is HTM, HTML, JSP, PLG, HTX, or STM by using browsers:
    • If you use an OSS endpoint, Content-Disposition:'attachment=filename;' is automatically included in the response header. Web page objects are downloaded as attachments. You cannot preview the object content.
    • When you use a bound custom domain name, Content-Disposition:'attachment=filename;' is not included in the response header. You can preview the object content if your browser supports previews of web page objects.
  • A bucket cannot have versioning and static website hosting configured at the same time. If versioning is enabled for a bucket, you cannot configure static website hosting for the bucket. For more information about versioning, see Overview.

For more information, see Static website hosting.


  1. Log on to the OSS console.
  2. Click Buckets, and then click the name of the target bucket.
  3. Choose Basic Settings > Static Pages. Click Configure in the Static Pages section. Configure the parameters listed in the following table.
    Parameter Description
    Default Homepage Specify an index page that functions similar to index.html. Only HTML objects can be specified as the index page. Static website hosting is disabled if you do not specify this parameter.
    Default 404 Page Specify the default 404 page to display when the requested resource does not exist. Only the HTML, JPG, PNG, BMP, or WebP object in the root folder can be specified as the default 404 page. Default 404 Page is disabled if you do not specify this parameter.
    Note You must ensure that both the index and error documents are readable. Otherwise, static pages cannot be accessed.
  4. Click Save.