S3 static site hosting with my domain: why aws manual doesn't work for me?

▼魔方 西西 提交于 2019-12-12 00:25:50

问题


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. I created two buckets mydomain.com and www.mydomain.com.
  2. I added bucket policy to mydomain.com:

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

  3. 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.

  4. 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.

  5. 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 goes to nowhere... Help, please.


回答1:


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.

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.

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.

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



来源:https://stackoverflow.com/questions/31286823/s3-static-site-hosting-with-my-domain-why-aws-manual-doesnt-work-for-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!