如何使用自定义源正确设置 Amazon Route 53、CloudFront [英] How to correctly set up Amazon Route 53, CloudFront with custom origin
问题描述
我目前使用 Amazon Route 53 进行 DNS 设置和自定义源(Amazon 之外的网络服务器).我想将 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?
- CloudFront 从裸域的 IP 地址中提取数据
- 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 所以我最终是这样解决的:
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 asdomain.com
- My .htaccess file redirects
domain.com
towww.domain.com
:
Amazon CloudFront:
备用域名 (CNAME)"设置为
www.domain.com
原点设置为origin.domain.com
亚马逊 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屋!