使用我的域托管 S3 静态站点:为什么 aws 手册对我不起作用? [英] S3 static site hosting with my domain: why aws manual doesn't work for me?

查看:20
本文介绍了使用我的域托管 S3 静态站点:为什么 aws 手册对我不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过很多关于这个问题的手册,尤其是 AWS 的官方文档 但它对我不起作用,我不明白为什么.

I've seen a lot of manuals about this question and especially AWS' official docs but it doesn't work for me and I cann't understand why.

  1. 我创建了两个存储桶 mydomain.com 和 www.mydomain.com.
  2. 我向 mydomain.com 添加了存储桶策略:

  1. I created two buckets mydomain.com and www.mydomain.com.
  2. I added bucket policy to mydomain.com:

{"版本": "2012-10-17",陈述": [{"Sid": "AddPerm","Effect": "允许","校长": "","Action": "s3:GetObject","Resource": "arn:aws:s3:::mydomain.com/"}]}

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": "", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::mydomain.com/" } ] }

我为 mydomain.com 启用了启用网站托管"并将 index.html 放在那里.所以我有它的端点 mydomain.com.s3-website-us-east-1.amazonaws.com,它在打开 index.html 时很好.

I enabled "Enable website hosting" for mydomain.com and put index.html there. So I've got endpoint for it mydomain.com.s3-website-us-east-1.amazonaws.com which good in opening index.html.

我为 www.mydomain.com 启用了将所有请求重定向到另一个主机名"到 mydomain.com.s3-website-us-east-1.amazonaws.com.但根据 AWS 的官方说法,我应该重定向到 mydomain.com.但这对我不起作用,而我的重定向方式确实如此.无论如何,现在 www.mydomain.com.s3-website-us-east-1.amazonaws.com 在 mydomain.com.s3-website-us-east-1.amazonaws.com 中打开 index.htm.

I enabled "Redirect all requests to another host name" for www.mydomain.com to mydomain.com.s3-website-us-east-1.amazonaws.com. But according to AWS' official I should do redirect to mydomain.com. But it doesn't work for me, and my way of redirect does. Anyway now www.mydomain.com.s3-website-us-east-1.amazonaws.com opens index.htm in mydomain.com.s3-website-us-east-1.amazonaws.com.

Mydomain 在 AWS route53 上注册,所以我去那里创建了一个别名到 s3-website-us-east-1.amazonaws.com 就像在文档中一样.我已经等了 24 小时,但没有任何变化......

Mydomain registred with AWS route53, so I went there and created A Alias to s3-website-us-east-1.amazonaws.com exacly like in docs. I have been waiting for 24 hours, but nothing changes...

mydomain.com 无处可去...请帮忙.

mydomain.com goes to nowhere... Help, please.

推荐答案

您正在做的事情的基础似乎是正确的;但是,我怀疑您错过了一个步骤,如果没有看到实际的记录/配置,就很难知道在哪里.

The basics of what you are doing seem right; however, I suspect you missed a step and it is hard to tell where without seeing the actual records/configs.

例如,如果站点是静态的并且位于 cloudfront 上,除了将您的域指向那里之外,请确保将 cloudfront 中的备用域名"设置为 mydomain.

For example, if the site is static and on cloudfront, make sure that you set the 'alternate domain name' in cloudfront to mydomain in addition to pointing your domain there.

此外,了解您的 route53 条目是否解析为一个根本没有响应的地址,或者 route53 域是否根本无法解析会很有帮助.为此,您可以在 mydomain 上执行 nslookup 并发布结果.

Also, it would be helpful to know if your route53 entry is resolving to an address which is simply not responding, or if the route53 domain is not resolving at all. To do that, you would do an nslookup on mydomain and post the results.

另外,看看这些,它们可能会有所帮助:http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

Also, see these, they might help: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-alias.html

这篇关于使用我的域托管 S3 静态站点:为什么 aws 手册对我不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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