在EC2实例上设置SSL证书

sty*_*ets 20 linux ssl amazon-ec2 ssl-certificate amazon-web-services

我很难在我的EC2微实例上尝试设置SSL证书(这是从NameCheap追溯的Comodo PositiveSSL)(我使用的是基于CentOS的Amazon Linux AMI 2012.3,如果我没有弄错的话).

这是我做的:

  1. 我安装了mod_ssl和OpenSSL

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

  3. 我按照Comodo的建议将*.key和*.crt文件修改为777

  4. 我确定IP地址和文件路径是正确的(在示例中放了一堆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>
Run Code Online (Sandbox Code Playgroud)

然后我重新启动了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!.
Run Code Online (Sandbox Code Playgroud)

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

我几天来一直在撞墙.我很确定我错过了一些小东西来完成这项工作,我只是不知道到底是什么.

如果有人可以提出一些建议,我会非常感激!

The*_*ude 22

有时这部分

<VirtualHost _default_:443>
Run Code Online (Sandbox Code Playgroud)

阻止您使用真正的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>
Run Code Online (Sandbox Code Playgroud)

确保在此之后重启apache.