简体   繁体   English

AWS 将子域路由到 s3 static 托管

[英]AWS route subdomain to s3 static hosting

Lets say I have a hosted zone - hostabc.com and have an SSL Acm on that hosted zone.假设我有一个托管区域 - hostabc.com 并在该托管区域上有一个 SSL Acm。

  1. I created a S3 bucket name static-site with static hosting - static-site.s3-us-east-1.amazonaws.com.我使用 static 托管创建了一个 S3 存储桶名称静态站点- static-site.s3-us-east-1.amazonaws.com。
  2. I create a subdomain - static.hostabc.com and route the alias to the S3 bucket我创建了一个子域 - static.hostabc.com 并将别名路由到 S3 存储桶

However when I access to some of the assets static.hostabc.com/style.css.但是,当我访问一些资产 static.hostabc.com/style.css 时。 The address url wasn't set SSL on it.地址 url 上没有设置 SSL。 How do I resolve this?我该如何解决这个问题?

Unfortunately, you can't use an SSL certificate with an S3 static website and a custom domain.不幸的是,您不能将 SSL 证书与 S3 static 网站和自定义域一起使用。

I would recommend using AWS CloudFront to handle this.我建议使用 AWS CloudFront 来处理这个问题。 You can point your sub domain to the CloudFront Distribution, which in turn resolves to your S3 static website.您可以将您的子域指向 CloudFront 分配,后者又会解析为您的 S3 static 网站。 You can associate a CloudFront Distribution with an SSL certification in ACM.您可以将 CloudFront 分配与 ACM 中的 SSL 认证相关联。

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

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