简体   繁体   English

在Godaddy上将域配置到Amazon S3存储桶

[英]Configure domain on Godaddy to Amazon S3 bucket

I have the static website hosted on S3 which is displaying correctly using the Amazon s3 link. 我在S3上托管了静态网站,该网站使用Amazon s3链接正确显示。

As per Amazon docs, I created two buckets, example.io & www.example.io. 根据Amazon文档,我创建了两个存储桶,example.io和www.example.io。 The example.io has the content (files) for the website; example.io具有网站的内容(文件); the www.example.io bucket is redirecting to the phlo.io bucket. www.example.io存储桶将重定向到phlo.io存储桶。

I am trying to configure Godaddy Apex domain DNS settings to redirect to the S3 bucket. 我正在尝试配置Godaddy Apex域DNS设置以重定向到S3存储桶。 As an example, the domain is http://example.io & I entered the settings in Godaddy domain DNS in the following form: 例如,域为http://example.io ,我以以下形式在Godaddy域DNS中输入了设置:

Type: CNAME
Name: www
value: example.io.s3-website.eu-west-2.amazonaws.com
TTL: 1 hour

However, the website is not displaying on the link http://example.io . 但是,该网站未显示在链接http://example.io上 How do I configure the apex domain to display the static website? 如何配置apex域以显示静态网站?

You can't, sorry... AWS do not provide an IP Address that you can add as the Apex A Record. 您不能,抱歉... AWS没有提供您可以添加为Apex A记录的IP地址。 This causes issues using S3, CloudFront, ELB, and API Gateway. 这会导致使用S3,CloudFront,ELB和API网关出现问题。

If you are using AWS Route53, you can set the Apex A Record as an "alias" to those other services in your AWS account. 如果您使用的是AWS Route53,则可以将Apex A记录设置为AWS账户中那些其他服务的“别名”。 This is an AWS bespoke service to get around only being able to set an A Record IP Address as the Apex Address. 这是一项AWS定制服务,旨在仅将A Record IP地址设置为Apex地址即可解决。

So you can either move your DNS to AWS, or use a www redirection service. 因此,您可以将DNS移至AWS或使用www重定向服务。 This will provide you with an IP Address which will respond with a redirection to your www.example.io address. 这将为您提供一个IP地址,该地址将重定向到您的www.example.io地址。 People often use services like wwwizer.com to do this for free: http://wwwizer.com/naked-domain-redirect 人们经常使用wwwizer.com之类的服务免费进行此操作: http ://wwwizer.com/naked-domain-redirect


On further investigation, it turns out that GoDaddy offers http redirection in its DNS service. 经过进一步调查,结果发现GoDaddy在其DNS服务中提供了http重定向。 Here is a guide to setting up naked domain name redirection to the www sub domain: https://help.ghost.org/article/17-custom-domains-using-godaddy 这是将裸域名重定向到www子域的指南: https : //help.ghost.org/article/17-custom-domains-using-godaddy

Steps to follow to redirect all traffic from www.yourdomain.com to www.yours3bucket.amazonaws.com 将所有流量从www.yourdomain.com重定向到www.yours3bucket.amazonaws.com的步骤

  1. Create a bucket with the same name as your domain name(in this case www.yourdomain.com), make it public and host it. 创建一个与您的域名同名的存储桶(在本例中为www.yourdomain.com),将其公开并托管。
  2. Go to Godaddy DNS Server and Enter a CNAME Entry with host as www, Points to as www.yours3bucket.amazonaws.com and TTL as default. 转到Godaddy DNS服务器并输入一个CNAME项,其主机为www,指向www.yours3bucket.amazonaws.com,默认为TTL。 (This is to redirect all the traffic to your AWS S3 Bucket, It will only work with www.yourdomain.com and not with yourdomain.com if you do not set a forwarding as mentioned on step 3) (这是将所有流量重定向到您的AWS S3存储桶,如果您未按步骤3所述设置转发,则仅适用于www.yourdomain.com,不适用于yourdomain.com)
  3. Now also add a 301 forwarding to http://www.yourdomain.com or https://www.yourdomain.com . 现在,还将301转发添加到http://www.yourdomain.comhttps://www.yourdomain.com (This is to forward yourdomain.com to www.yourdomain.com) (这是将yourdomain.com转发到www.yourdomain.com)

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

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