AWS::S3::NoSuchKey 指定的键不存在 [英] AWS::S3::NoSuchKey The specified key does not exist
问题描述
我正在尝试从 S3 (mydomain.com/frontend-beta
) 提供网站的一部分.
I am trying to serve part of website from S3 (mydomain.com/frontend-beta
).
我创建了名为 frontend-beta
的存储桶,并启用了具有所有必要权限的静态网络托管.还可以访问 http://frontend-beta.s3-website-us-east-1.amazonaws.com 没有任何错误.
I created bucket with name frontend-beta
and enabled static web hosting with all necessary permissions. Also able to access http://frontend-beta.s3-website-us-east-1.amazonaws.com with out any error.
当我从提供主网站 (mydomain.com
) 的位置更新 nginx 配置并尝试访问 mydomain.com/frontend-beta
时,我收到以下错误>
When I update nginx config from where main website (mydomain.com
) is served and try to access mydomain.com/frontend-beta
I get following error
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: frontend-beta/index.html
RequestId: 6A36E8E8DF29FBCC
HostId: SW2qCgYnhwHtXcDtD8saTIBV6YuExZ8dSZzZPedAYtagyVTq3O00BHAXAotknuF4rRUDJ1xeQYo=
实际上存储桶/文件确实存在(frontend-beta/index.html
),但不知道为什么它无法访问它.
in fact bucket/file does exist (frontend-beta/index.html
), but don't know why its not able to access it.
这是我的 nginx 配置
here is my nginx config
http {
upstream frontend-beta {
server frontend-beta.s3-website-us-east-1.amazonaws.com;
}
}
server {
.
.
.
location /frontend-beta/ {
proxy_pass http://frontend-beta;
}
}
有人知道我在这里遗漏了什么吗?
Anyone know whats I am missing here ?
推荐答案
查看日志文件您的密钥是错误的,因此可能某些重定向转到 index.html :
Look at log file your key is wrong, so probably some redirection goes to index.html :
Key: frontend-beta/index.html
您的密钥应该与 S3 中的对象名称相匹配
your key should match what is object name in S3
这篇关于AWS::S3::NoSuchKey 指定的键不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!