使用带有静态托管的AWS S3存储桶设置域名 [英] Domain name setup with AWS S3 bucket with static hosting

查看:127
本文介绍了使用带有静态托管的AWS S3存储桶设置域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的域名链接到AWS S3上的静态网站

Im trying to link my domain name to a static website on aws S3

我在S3上设置了2个存储桶,一个是domain.com,另一个是www.domain.com. doamin.com已启用静态网站托管 www.domain.com重定向到domain.com

I have 2 buckets set up on S3 one is domain.com and the other is www.domain.com. doamin.com has static website hosting enabled www.domain.com redirects to the domain.com

我可以通过以下方式访问我的索引页: https://s3.us-east-2.amazonaws.com/domain.com/index.html 但不适用于此网址,并且我收到拒绝访问的消息: https ://s3.us-east-2.amazonaws.com/domain.com

I can access my index page through: https://s3.us-east-2.amazonaws.com/domain.com/index.html but it doesn't work with this url and I get an access denied message: https://s3.us-east-2.amazonaws.com/domain.com

我有2个主机记录,均是CNAME:

I have 2 host records both are CNAME:

主持人:@ 值:www.domain.com.s3-website-us-east-2.amazonaws.com

Host: @ Value: www.domain.com.s3-website-us-east-2.amazonaws.com

主持人:www 值:domain.com.s3-website-us-east-2.amazonaws.com.

Host:www Value: domain.com.s3-website-us-east-2.amazonaws.com.

在我的浏览器中,当我将其中任何一个cname值用作我的URL时,都说无法访问站点".另外,我的域名已在NameCheap上注册,并且由于域名不够旧而无法将其转移到路由53.我以前从未做过此事,所以我真的不明白自己在做错什么.

In my browser it says "site can't be reached" when I have either of those cname values as my url. Also my domain is registered with NameCheap and I can't transfer it to route 53 as it is not old enough. I've never done this before so I really don't understand what I'm doing wrong.

推荐答案

您无需将域转移到AWS.您需要做的就是在AWS路由53中创建一个托管区域.您要做的是在AWS内设置新的DNS配置,然后告诉您的注册商(NameCheap)使用AWS名称服务器.

You don't need to transfer the domain to AWS. All you need to do is create a hosted zone in AWS route 53. What you're going to do is set up a new DNS configuration inside AWS and then tell your registrar (NameCheap) to use the AWS nameservers.

  1. 使用您的域名domain.com创建托管区域
  2. 为您的域创建A记录.在右侧,您将看到一个单选按钮别名",选择是",然后单击目标框,等待您的存储段出现在S3网站端点下. (有关更多信息,请参见下文).
  3. 选择您的存储桶,然后单击创建".
  4. 转到您的注册服务商NameCheap并配置名称服务器以使用来自AWS托管区域的NS记录中的AWS名称服务器.

为此,您需要确保正确命名和配置了S3存储桶.

In order for this to work you need to make sure your S3 bucket is named and configured correctly.

  1. 您的存储桶名称必须与域名匹配.
  2. 在属性"标签中,您需要启用静态网站托管选项并提供索引页面.
  3. 在权限标签中,点击存储桶策略,然后点击底部的策略生成器链接.
  4. 在策略生成器中,选择S3作为策略类型
  5. 将主体设置为*
  6. 将操作设置为获取对象"
  7. 将ARN设置为您的存储桶/*的ARN.例如arn:aws:s3 ::: domain.com/*
  8. 单击添加"语句,然后生成策略并将其粘贴到存储桶策略中并保存.

最后上传您的资产,您就完成了

Finally upload your assets and you're done

这篇关于使用带有静态托管的AWS S3存储桶设置域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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