RapidSSL:域名与证书通用名称或SAN不匹配

我正在Amazon AWS(负载平衡器)上安装SSL证书(RapidSSL)。

安装已经完成,但是当我testing时,我得到:

Wrong certificate installed. The domain name does not match the certificate common name or SAN. Certificate information Common name: ip-172-XX-XX-XXX SAN: 

我的SSL证书只适用于https://app.domain.com ,所以SSL证书是为app.domain.com制作的


编辑:经过一些testing,我得到:

 The certificate is self-signed. Users will receive a warning when accessing this site unless the certificate is manually added as a trusted certificate to their web browser. You can fix this error by buying a trusted SSL certificate None of the common names in the certificate match the name that was entered (app.domain.com). You may receive an error when accessing this site in a web browser. Learn more about name mismatch errors. Common name: ip-172-XX-XX-XXX Organization: SomeOrganization Location: SomeCity, SomeState, -- Valid from July 23, 2014 to July 23, 2015 Serial Number: 218621 (0x5566) Signature Algorithm: sha256WithRSAEncrypt Issuer: ip-172-XX-XX-XXX 

编辑2:检查我find的服务器:

在文件夹/ ssl / certs中

 localhost.crt //this is the one giving me trouble ca-bundle.crt ca-bundle.trust.crt 

我应该删除localhost.crt吗?

谢谢

SubjectCN中使用的主机名(可选,但常用)和SubjectAN中至less一个条目(必需)需要与您引用VirtualHost的名称(无论您是通过名称(使用SNI)还是通过IP生成VirtualHost) 。 另外,你应该把这个主机名定义为/ etc / hosts中的主要主机名或别名。 请注意,这需要是FQDN,因为匹配必须是准确的[1]。

如果证书是针对“app.domain.com”发布的,则必须让应用程序监听并响应“app.domain.com”的请求。 出于testing目的,您可以将操作系统所看到的主机名更改为“app.domain.com”(使用hostname命令并在“/ etc / hostname”文件中设置“HOSTNAME”参数)。


1:请注意,大多数authentication机构将不会为非限定主机名颁发证书,因为他们无法确保他们所凭借的证书和certificate其关系的主机名属于请求没有域组件的个人或组织

第一 :请不要删除你的localhost.crt。 如果你这样做,你将无法重新启动你的服务器,你的网页将脱机。 如果您有任何机会,您必须使用以下命令从您的私钥重新生成一个新的localhost.crt文件:

 openssl req -new -x509 -nodes -sha1 -days 365 -key /etc/pki/tls/private/localhost.key > /etc/pki/tls/certs/localhost.crt 

其次 :如果您完成了使用负载平衡器创build证书的过程, 则不需要使用AWS IAM或更改您的ssl.conf文件。 缺less的步骤是更改您的域logging集。 如果您的域名在AWS中托pipe,请转到EC2pipe理控制台中的“ 路由53 ”并创build一个logging集。 它必须是A类logging(而不是CNAME ),别名指向您的Amazon负载均衡器 (在面板的DNS选项卡中查看您的地址)。 地址应该是这样的:

 9999999999.eu-west-1.elb.amazonaws.com