[英]Redirecting a subdomain to an S3 bucket while main site is hosted on Wordpress?
We've got a main website ( www.example.com ) which is hosted on Wordpress.我们有一个主网站 ( www.example.com ),它托管在 Wordpress 上。 I've built a replacement site which I've hosted in AWS S3 (test.example.com.s3-website-ap-southeast-2.amazonaws.com/).
我已经建立了一个在 AWS S3 中托管的替代站点(test.example.com.s3-website-ap-southeast-2.amazonaws.com/)。 The DNS records for the main website are hosted on Route 53.
主网站的 DNS 记录托管在 Route 53 上。
I'd like the replacement site to be accessible from test.example.com while keeping the main site running.我希望可以从 test.example.com 访问替换站点,同时保持主站点运行。 I've put the following DNS record in Route 53:
我在 Route 53 中放置了以下 DNS 记录:
test.example.com CNAME Simple -
test.example.com.s3-website-ap-southeast-2.amazonaws.com.
However, browsing to test.example.com still brings me to the main site, not the replacement site.但是,浏览 test.example.com 仍然会将我带到主站点,而不是替换站点。
What am I doing wrong?我究竟做错了什么?
Try to use an A
alias record in Route53 instead of CNAME
.尝试在 Route53 中使用
A
别名记录而不是CNAME
。
Also, make sure you:此外,请确保您:
test.example.com
, then your bucket name should read test.example.com
test.example.com
,那么您的存储桶名称应为test.example.com
Static website hosting
on your bucketStatic website hosting
Block public access
setting to Off
andBlock public access
设置设置为Off
,然后{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::test.example.com",
"arn:aws:s3:::test.example.com/*"
]
}
]
}
I would recommend to put your static S3 website behind CloudFront.我建议将您的 static S3 网站放在 CloudFront 后面。 You will benefit from its low latency and high transfer rates for your end users.
您将受益于它为您的最终用户带来的低延迟和高传输率。 Also, your S3 bills will be noticeably reduced (if served to a large number of users).
此外,您的 S3 账单将显着减少(如果提供给大量用户)。
And last but not least, you will be able to serve your static web-site via https
.最后但同样重要的是,您将能够通过
https
为您的 static 网站提供服务。 Your current solution works via http
only.您当前的解决方案仅通过
http
工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.