gpt4 book ai didi

amazon-web-services - 使用 AWS S3 和 ACM 在子域上启用 SSL

转载 作者:太空宇宙 更新时间:2023-11-03 12:48:20 24 4
gpt4 key购买 nike

我有一个位于 S3 上的网站 example.com。我已经为此站点成功设置了 HTTP -> HTTPS 转发。

我还有一个子域,blog.example.me,它也存在于 S3 上,我想启用 SSL。目前,它仅支持 HTTP。我使用 Route 53 进行路由,使用 Cloudfront 作为 CDN。

我已查找有关此问题的文档,但尚未找到有效的方法。我必须创建一个新证书,还是可以使用 example.com 使用的相同证书?如果我可以使用相同的证书,我应该从哪个 AWS 开始?

最佳答案

对于证书,它取决于它是否是涵盖通配符证书的整个域示例的通配符证书 *.example.com 您可以为您的 sub 使用相同的证书域名

具有 S3 和 Cloudfront 的典型托管安全站点将遵循以下步骤

创建 S3 存储桶

桶名-你的域名

选择您的存储桶,转到属性 -> 静态网站托管,然后启用网站托管

授予公共(public)读取权限以允许云端从您的存储桶中读取。

获取 SSL 证书/如果适用则使用现有的

AWS 提供免费的 SSL 证书,适用于支持 SNI 的浏览器。您可以导入自己的 SSL 证书。

CloudFront 配置

Create a new Web distribution. Under Origin Settings, use the Endpoint you copied from your S3 bucket’s static hosting setup. Many other guides instruct this without explaining why — this is because if you have redirect rules configured with your S3 bucket and you specify the internal AWS S3 resource, the redirects will no longer work. Therefore, you must specify the website endpoint domain to ensure redirection functionality works.

Under Default Cache Behavior Settings, it’s worth selecting Redirect HTTP to HTTPS and narrowing down the Allowed HTTP Methods — for a static website, GET and HEAD will do.

在云端分发设置下配置:

  • 在备用域名下设置您的域名(yourdomain.com,以及可选的 www.yourdomain.com)
  • 通过选择自定义 SSL 证书配置 SSL,然后选择证书生成或导入证书管理器。
  • 最后,指定默认根对象。这应该与您的 S3 匹配bucket的Index Document,通常是index.html。这就是所有的地方当客户端请求您的网站 URL 时,请求将被重定向到无路可走

Route 53 配置:

  • 前往托管区域

  • 为您要使用的域或子域选择托管区域

  • 为您的站点创建一个记录:选择别名,在下拉列表中您应该会看到您的云端分布,选择它作为您的别名目标并保存。

更多详细信息请查看:https://medium.com/@willmorgan/moving-a-static-website-to-aws-s3-cloudfront-with-https-1fdd95563106

关于amazon-web-services - 使用 AWS S3 和 ACM 在子域上启用 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48486174/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com