【发布时间】:2018-07-28 06:56:14
【问题描述】:
我有一个名为 mywebsite.com(不是真实姓名)的 S3 存储桶。在存储桶中,我有一个网站的静态内容,位于一个名为 build 的文件夹中。
build文件夹ls build/的内容:
asset-manifest.json index.html manifest.json static
favicon.ico lu1.png service-worker.js
我公开了存储桶:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::mywebsite.com/*"
}
]
}
所以我应该可以从这里访问存储桶:
http://mywebsite.com.s3-website.eu-west-2.amazonaws.com(不是真实网址)
然后,对于Index document 和Error document,我尝试指定:
build/index.html
但是,如果我尝试这样做,我会得到:
The IndexDocument Suffix is not well formed
所以我将Index document 和Error document 保留为index.html。
但是现在找不到索引文件了:
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: index.html
我尝试了here、here 和here 的建议,但错误仍然存在。
这似乎是一个非常普遍的问题。那么,您是如何做到让 S3 能够在文件夹中看到您的 index.html 的呢?
【问题讨论】:
标签: amazon-web-services amazon-s3