在EC2实例上设置SSL证书

我很难在我的EC2微型实例(如果我没有弄错的话,我使用基于CentOS的Amazon Linux AMI 2012.3)设置一个SSL证书(这是一个从NameCheap中获得的Comodo PositiveSSL)。

以下是我所做的:

  1. 我安装了mod_ssl&OpenSSL

  2. 我启用了我的EC2实例安全组上的端口443

  3. Comodobuild议我将* .key&* .crt文件CHMOD到777

  4. 我确定IP地址和文件path是正确的(在示例中放了一串0,但在我的ssl.conf中正确的)

  5. 我将这个VirtualHost条目添加到ssl.conf


<VirtualHost 00.000.000.00:443> ############# I tried both with & without this section ############## ServerName www.mydomain.com:443 ServerAlias www.mydomain.com DocumentRoot /var/www ServerAdmin webmaster@mydomain.com ###################################################################### SSLEngine on SSLCertificateKeyFile /etc/ssl/mydomain_com.key SSLCertificateFile /etc/ssl/mydomain_com.crt SSLCertificateChainFile /etc/ssl/mydomain_com.ca-bundle </VirtualHost> 

然后我重新启动Apache …但我仍然无法访问 https://www.mydomain.com/ !

我说,与ssltool.com检查

 The Common Name on the certificate is: ip-00-00-00-000 The certificate chain consists of: SomeOrganization, ip-00-00-00-000. Expires on: Apr 10 13:39:41 2013 GMT - that's 363 days from today. The site tested mydomain.com is NOT the same as the Subject CN ip-00-00-00-000!. 

我甚至去复制VistualHost到httpd.conf而不是ssl.conf并重新启动apache,都是徒劳的。

现在我已经把头撞在墙上了。 我很确定我错过了一个小小的东西来完成这个工作,我只是不知道究竟是什么。

如果有人能够提出build议,我将无限感激!

有时候这个部分

 <VirtualHost _default_:443> 

阻止您使用真正的SSL证书。 如果是这种情况,注释VirtualHost 默认或移动SSLCertificate *属性,即。

 <VirtualHost _default_:443> SSLCertificateKeyFile /etc/ssl/mydomain_com.key SSLCertificateFile /etc/ssl/mydomain_com.crt SSLCertificateChainFile /etc/ssl/mydomain_com.ca-bundle </VirtualHost> 

确保你在这之后重新启动apache。

亚马逊现在提供证书管理器 ! (免费)

如果你使用Elastic Beanstalk,这是一个新的方法:它是免费的,你可以避免由于配置而导致的错误,它是vue性能点的更好选择:

由于ELB支持SSL卸载,因此将证书部署到负载平衡器(而不是其后面的EC2实例)将减少实例需要处理的加密和解密工作量。

来自doc:

新的AWS证书管理器(ACM)旨在简化和自动化传统上与SSL / TLS证书管理相关的许多任务。 ACM负责管理数字证书的供应,部署和更新的复杂性! 由ACM提供的证书由亚马逊的认证机构(CA),亚马逊信托服务(ATS)进行验证。

更好的是,你可以做所有这一切,不需要额外的费用。 通过AWS Certificate Manager提供的SSL / TLS证书是免费的!

ACM将允许您在几分钟内开始使用SSL。 在您申请证书后,您可以通过几次点击将其部署到Elastic Load Balancer和Amazon CloudFront分配。 在此之后,ACM可以照顾定期更新而无需采取任何行动。

文档:

https://aws.amazon.com/fr/blogs/aws/new-aws-certificate-manager-deploy-ssltls-based-apps-on-aws/