大网数据广告活动
服务器运维问答

s3 static site: Amazon using wrong bucket

· 52CE 我爱测

I'm setting up a static site, hosted on S3, using this set of directions: https://www.linode.com/docs/platform/object-storage/host-static-site-object-storage/ I've set my bucket up with the name holisticnetworking.net-static. I w…

问题原文

原帖链接 · tjb74 · CC BY-SA 4.0

I'm setting up a static site, hosted on S3, using this set of directions: https://www.linode.com/docs/platform/object-storage/host-static-site-object-storage/

I've set my bucket up with the name holisticnetworking.net-static. I walked through the process of setting up the bucket to serve over HTTPS and checking the info, it seems to work fine:

tomb@MacBook-Pro-3 ~ % s3cmd ws-info s3://holisticnetworking.net-static
Bucket s3://holisticnetworking.net-static/: Website configuration
Website endpoint: http://holisticnetworking.net-static.s3-website-us-east-1.amazonaws.com/
Index document:   index.html
Error document:   404.html

You can also browse to the bucket endpoint and that works fine, too: http://holisticnetworking.net-static.s3-website-us-east-1.amazonaws.com/

The strange problem I find at the end of that journey is that when I browse to the site I get the following error message:

Code: NoSuchWebsiteConfiguration
Message: The specified bucket does not have a website configuration
BucketName: holisticnetworking.net
RequestId: xxx
HostId:xxx

Note that, for some strange reason, the bucket the error appears to point to is another one called holisticnetworking.net. Not the -static bucket.

Does anyone have any idea what is happening, here?

已采纳解答

原帖链接 · Michael - sqlbot · CC BY-SA 4.0

A custom domain name must match the bucket name.

Amazon S3 sees only the original hostname www.example.com and is unaware of the CNAME mapping used to resolve the request. So the CNAME and the bucket name must be the same.

https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html

To disconnect the hostname of your site from the actual name of the bucket requires that you use CloudFront in addition to S3, pointing your DNS record to CloudFront and pointing CloudFront to the bucket.

I walked through the process of setting up the bucket to serve over HTTPS

It's not clear what you mean by that. You can't use HTTPS on a custom domain with an S3 bucket without also using CloudFront.

The Amazon S3 website endpoints do not support HTTPS.

https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

See https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-https-requests-s3/

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-12-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。