简体   繁体   English

无法使用 AWS S3 将域定向到 static 页面

[英]Can't direct a domain to a static page using AWS S3

I followed this tutorial H ow to Point your Domain to an S3 Website Bucket and it works well.我按照本教程如何将您的域指向 S3 网站存储桶,并且效果很好。

My domain eg domain.com points my S3 Bucket bucket.com.s3-website.eu-central-1.amazonaws.com.我的域,例如 domain.com 指向我的 S3 Bucket bucket.com.s3-website.eu-central-1.amazonaws.com。

However, the index.html does not show by default eg if I use the URL domain.com I get this:但是,默认情况下 index.html 不显示,例如,如果我使用 URL 域。com 我明白了:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>AE243F85AC91D283</RequestId>
<HostId>zAcaxygehDiR1EC6/JJADndO+JlvA7dYSAu+uOL7qWtdDGWLLQ+vGCoqescLUAKLH51/kLD/StM=</HostId>
</Error>

However, if I use domain.com/index.html or bucket.com.s3-website.eu-central-1.amazonaws.com the index.html page appears. However, if I use domain.com/index.html or bucket.com.s3-website.eu-central-1.amazonaws.com the index.html page appears.

It's only if I use domain.com instead of the above that it doesn't show.只有当我使用 domain.com 而不是上面它不显示时。

The bucket has all public permissions.存储桶具有所有公共权限。

You're getting an error.你得到一个错误。 If you are only interested in showing the index.html page whenever the plain domain.com url is used, then you need to specify index.html as the error page as well. If you are only interested in showing the index.html page whenever the plain domain.com url is used, then you need to specify index.html as the error page as well.

Alternatively, you can do this with a redirect rule in the box below或者,您可以使用下面框中的重定向规则来执行此操作

<RoutingRules>
    <RoutingRule>
    <Condition>
      <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals >
    </Condition>
    <Redirect>
      <ReplaceKeyWith>index.html</ReplaceKeyWith>
    </Redirect>
    </RoutingRule>
</RoutingRules>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM