Amazon S3 静态网站的 HTTPS [英] HTTPS for Amazon S3 static website
问题描述
我想使用 Amazon S3 和 CloudFront 托管一个仅支持 HTTPS 的静态网站.这是我到目前为止所做的:
I want to host a HTTPS-only static website using Amazon S3 and CloudFront. Here's what I've done so far:
- 为静态网站托管设置 S3 存储桶并将我的网站文件放入其中
- 创建一个 CloudFront 分配并将其指向 S3 存储桶
- 在我的域的域名服务器中为
www
子域添加了一条 CNAME 记录,指向 CloudFront 存储桶.
- Set up an S3 bucket for static website hosting and put my website files in it
- Created a CloudFront distribution and pointed it to the S3 bucket
- Added a CNAME record in my domain's nameservers for the
www
subdomain pointing to the CloudFront bucket.
到目前为止,一切都很好 - 我可以使用 www.example.com
地址访问我的网站.但是,我希望该站点只能通过 HTTPS 访问,为此我从 GoDaddy 购买了 SSL 证书.
So far, so good - I can access my website using the www.example.com
address. However, I want the site to be available via HTTPS only, for which I bought an SSL certificate from GoDaddy.
现在的问题是:
- 是否可以在我的 S3 托管网站上安装此第三方 SSL 证书?
- 有没有办法通过这种设置自动从 http 到 https 重定向?
推荐答案
是的,从今天开始,您可以免费完成.
Yes, as of today you can do it at no charge.
您现在可以在 CloudFront 上将 HTTPS 与 CNAME 结合使用,因为它现在支持使用服务器名称指示 (SNI) 的自定义 SSL 证书:http://aws.typepad.com/aws/2014/03/server-name-indication-sni-和-http-redirection-for-amazon-cloudfront.html
You can now use HTTPS with CNAMEs on CloudFront as it now supports custom SSL certificates using Server Name Indication (SNI): http://aws.typepad.com/aws/2014/03/server-name-indication-sni-and-http-redirection-for-amazon-cloudfront.html
我设法在 S3 上为我的 CloudFront 分布式静态站点设置了一个免费的 Class 1 StartSSL 证书,没有太多麻烦(请参阅:使用 SNI 通过 HTTPS 提供服务时出现 CloudFront 错误).
I managed to set up a free Class 1 StartSSL cert for my CloudFront distributed static site on S3 without too much trouble (see: CloudFront error when serving over HTTPS using SNI).
这篇关于Amazon S3 静态网站的 HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!