是否可以通过S3托管的内容来具有index.html功能? [英] Is there a way to have index.html functionality with content hosted on S3?

查看:105
本文介绍了是否可以通过S3托管的内容来具有index.html功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使S3默认为index.html页面?例如:我的存储桶对象列表:

Is there a way to make S3 default to an index.html page? E.g.: My bucket object listing:

/index.html
/favicon.ico
/images/logo.gif

调用 www.example.com/ index.html 效果很好!但是,如果要呼叫 www.example.com/,我们将获得403或REST对象,其中列出了XML文档,具体取决于存储桶级ACL的配置方式.

A call to www.example.com/index.html works great! But if one were to call www.example.com/ we'd either get a 403 or a REST object listing XML document depending on how bucket-level ACL was configured.

所以,问题是:有没有一种方法可以将index.html功能与内容托管在S3上?

So, the question: Is there a way to have index.html functionality with content hosted on S3?

推荐答案

Amazon S3现在支持

Amazon S3 now supports Index Documents

存储桶的索引文档可以设置为index.html之类的内容.访问网站的根目录或包含该名称的文档的子目录时,将返回该文档.

The index document for a bucket can be set to something like index.html. When accessing the root of the site or a sub-directory containing a document of that name that document is returned.

使用aws cli极其容易:

It is extremely easy to do using the aws cli:

aws s3 website $MY_BUCKET_NAME --index-document index.html

您可以从AWS管理控制台设置索引文档:

You can set the index document from the AWS Management Console:

这篇关于是否可以通过S3托管的内容来具有index.html功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆