托管静态网站,AWS S3和路线53 [英] Hosting static website with AWS S3 and Route 53

查看:1518
本文介绍了托管静态网站,AWS S3和路线53的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说我现在有一个专门的服务器上的网站www.a.com(完全静态),我想切换到AWS。

Let's say I currently have website www.a.com (entirely static) on a dedicated server and I want to switch to AWS.

到目前为止,我做了以下内容: 创建桶www.a.com,给予适当的权限,使其网络(可见公众),并上载的所有文件。获取 HTTP://www.a.com.s3-website- eu-west-1.amazonaws.com

So far I did the following: Create bucket www.a.com, give proper permission to make it web (visible for public) and uploaded all files. Obtain http://www.a.com.s3-website-eu-west-1.amazonaws.com.

我创建托管区的AWS路线53和自动得到了两个记录集,NS和SOA。 接下来,我添加了一个CNAME为* .a.com。与价值 HTTP://www.a.com.s3-website -eu-west-1.amazonaws.com

I created Hosted Zone in AWS Route 53 and automatically got two Record Sets, NS and SOA. Next, I added a CNAME for *.a.com. with value http://www.a.com.s3-website-eu-west-1.amazonaws.com

问题是现在,我该怎么添加一个A记录?我没有一个IP。 (由于没有A记录的原因,www.a.com工作,但a.com不工作)。

Question is now, what do I add for an A record? I don't have an IP. (As a cause of not having an A record, www.a.com works, but a.com does not work).

我可以使用专用服务器以某种方式继续投放电子邮件?我应该如何设置MX给我有一个WHM / cPanel的服务器?

Can I use my dedicated server somehow to keep serving email? How should I setup MX given I have a WHM/cPanel server?

感谢。

推荐答案

首先,我会建议加入所谓的a.com和工作过的一个附加斗,不要删除www.a.com虽然,你会随后的CNAME添加到如此www.a.com重定向到a.com在浏览器中。

First, I would recommend adding an additional bucket called a.com and working off of that, don't delete www.a.com though, you'll later add a CNAME to that so www.a.com redirects to a.com in the browser.

现在,您已经创建了a.com斗,选择属性>静态网站托管>启用虚拟主机>输入index.html,然后上传文件与该名你的水桶。

Now that you've created the a.com bucket, go to Properties > Static Website Hosting > Enable Website Hosting > enter index.html and upload a file with that name to your bucket.

然后进入属性>权限>编辑桶政策>粘贴低于code:

Then go Properties > Permissions > Edit Bucket Policy > Paste the code below:

{
  "Version":"2008-10-17",
  "Statement":[{
    "Sid":"PublicReadForGetBucketObjects",
        "Effect":"Allow",
      "Principal": {
            "AWS": "*"
         },
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::example-bucket/*"
      ]
    }
  ]
}

更改{例如斗}到{a.com}和保存。

Change {example-bucket} to {a.com} and save.

现在去Route53>选择您的域>转到记录集>创建记录集

Now go to Route53 > Select your domain > Go to record sets > create record set

确认类型设置为A,然后选择旁边的别名是的。点击进入别名目标区域,并在S3网站,你现在应该看到a.com。选择它,然后在底部选择建立记录集。

Make sure 'Type' is set to 'A' and then select 'Yes' next to 'Alias'. Click into the Alias Target area and under S3 websites you should now see a.com. Select it and then at the bottom choose 'Create record set'.

您就大功告成了。

这篇关于托管静态网站,AWS S3和路线53的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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