如何使用自定义来源正确设置Amazon Route 53,CloudFront [英] How to correctly set up Amazon Route 53, CloudFront with custom origin

查看:114
本文介绍了如何使用自定义来源正确设置Amazon Route 53,CloudFront的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用 Amazon Route 53 进行DNS设置和自定义来源(Amazon外部的Web服务器).我想将 CloudFront 添加到组合中,但是我不太确定如何设置它?

I am currently using Amazon Route 53 for my DNS setup and a custom origin (web server outside of Amazon). I'd like to add CloudFront to the mix but I'm not too sure how to set it up?

我已经看过亚马逊关于使用Route 53和CloudFront设置S3的指南,但是我似乎找不到关于使用自定义来源进行所有这些操作的任何信息.

I've seen Amazon's guide on setting up S3 with Route 53 and CloudFront, but I can't seem to locate any information on doing all this with a custom origin.

我应该按如下所述对其进行设置吗?

Should I be setting it up to work as follows?

  1. CloudFront从裸域的IP地址提取数据
  2. "www"只是CloudFront发行版的别名

我本来打算将内容托管在S3上,但由于我想对托管进行更多控制(例如,能够使用.htaccess文件并禁止黑客IP等)而决定拒绝托管该内容.

I originally planned to host my content on S3 but decided against it because I'd like more control over the hosting (for example, having the ability to use an .htaccess file and ban hacker IPs, etc).

谢谢.

推荐答案

好的,这就是我最终设法解决的方法:

OK so this is how I managed to solve it in the end:

来源服务器:

  • 在cPanel中(在我的原始服务器上)我创建了一个名为 origin.domain.com
  • 的子域
  • origin.domain.com domain.com
  • 共享相同的文档根目录
  • 我的.htaccess文件将 domain.com 重定向到 www.domain.com :
  • In cPanel (on my origin server) I created a sub-domain called origin.domain.com
  • origin.domain.com shares the same document root as domain.com
  • My .htaccess file redirects domain.com to www.domain.com:

Amazon CloudFront:

  • 备用域名(CNAMEs)"设置为 www.domain.com

原点设置为 origin.domain.com

Amazon Route 53

  • domain.com 的A记录设置为我的原始服务器的IP地址

  • The A record for domain.com is set to my origin server's IP address

www.domain.com 的A记录被设置为CloudFront发行版的别名

The A record for www.domain.com is set to an alias for the CloudFront distribution

origin.domain.com domain.com

顺便说一句,感谢Matt Houser和Bruce P的帮助.:)

Thanks to Matt Houser and Bruce P for their help, by the way. :)

这篇关于如何使用自定义来源正确设置Amazon Route 53,CloudFront的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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