S3 静态网站中的目录列表 [英] Directory Listing in S3 Static Website

查看:30
本文介绍了S3 静态网站中的目录列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个 S3 存储桶来托管静态文件.

I have set up an S3 bucket to host static files.

使用网站端点 (http://.s3-website-us-east-1.amazonaws.com/) 时: 它迫使我设置索引文件.当找不到文件时,它会抛出错误而不是列出目录内容.

When using the website endpoint (http://.s3-website-us-east-1.amazonaws.com/): it forces me to set an index file. When the file isn't found, it throws an error instead of listing directory contents.

使用 s3 端点 (.s3.amazonaws.com) 时:我获得了文件的 XML 列表,但我需要一个 HTML 列表,用户可以单击该文件的链接.

When using the s3 endpoint (.s3.amazonaws.com): I get an XML listing of the files, but I need an HTML listing that users can click the link to the file.

我已尝试在 AWS 控制台中将所有文件和存储桶本身的权限设置为所有人"的列表",但仍然没有运气.

I have tried setting the permissions of all files and the bucket itself to "List" for "Everyone" in the AWS Console, but still no luck.

我也尝试了一些 javascript 替代方案,但它们要么在网站 url 下不起作用(重定向到索引文件),要么根本不起作用.作为最后的手段,一个可折叠的 javascript 列表总比没有好,但我还没有找到一个好的.

I have also tried some of the javascript alternatives, but they either don't work under the website url (that redirects to the index file) or just don't work at all. As a last resort, a collapsible javascript listing would be better than nothing, but I haven't found a good one.

这可能吗?如果是这样,我是否需要更改权限、ACL 或其他内容?

Is this possible? If so, do I need to change permissions, ACL or something else?

推荐答案

我找到了 s3browser,这允许我在主网站上设置一个目录,允许浏览 s3 存储桶.它工作得很好,设置也很容易.

I found s3browser, which allowed me to set up a directory on the main web site that allowed browsing of the s3 bucket. It worked very well and was very easy to set up.

这篇关于S3 静态网站中的目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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