简体   繁体   English

“ www” CNAME不适用于S3存储桶

[英]“www” CNAME not working for S3 bucket

I have a website comprised of a few static pages hosted on an AWS S3 bucket. 我有一个网站,其中包含托管在AWS S3存储桶上的一些静态页面。 I added an A record that maps mysite.com to the bucket's address (via an alias). 我添加了一条A记录,该记录将mysite.com映射到存储桶的地址(通过别名)。 I also want users to be able to access my site via www.mysite.com , but when I add a CNAME mapping www.mysite.com. 我还希望用户能够通过www.mysite.com访问我的网站,但是当我添加CNAME映射www.mysite.com. to mysite.com it does not work. mysite.com它不起作用。 What could I possibly be doing wrong? 我可能做错了什么?

The domain name has to match the bucket name. 域名必须与存储桶名称匹配。 The fix is to create a second bucket with www. 解决方法是使用www.创建第二个存储桶www. in the name, point your www CNAME to that, and configure that bucket to redirect to the other bucket that contains your website. 在名称中,将www CNAME指向该名称,然后配置该存储桶以重定向到包含您的网站的其他存储桶。

The www.mysite.com should be an A record pointing to a separate S3 bucket. www.mysite.com应该是指向单独的S3存储桶的A记录。 If you want users to always go to your www site then you'll put your site files in the www bucket and setup your top-level domain bucket to redirect to www.mysite.com . 如果您希望用户始终访问您的www站点,则将站点文件放在www存储桶中,并设置顶级域存储桶以重定向到www.mysite.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM