Apache - 安装SSL证书

时间:2016-10-23 12:35:57

标签: apache ssl https certificate

我是ssl证书的新手,并在apache上安装。 我有以下虚拟主机设置

<VirtualHost *:443>
    ServerName www.beta.mysite.com
    SSLEngine on
    SSLCertificateFile /home/ec2-user/sslCerts/beta_mysite_com.crt
    SSLCertificateKeyFile /home/ec2-user/sslCerts/mySite.key
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
</VirtualHost>

证书的所有路径都有效 当我运行apache start命令时,我收到以下错误

Starting httpd: [Sun Oct 23 12:34:37 2016] [warn] _default_ VirtualHost overlap on port 443, the first has precedence

另外 - 我的ssl_error.log文件显示以下错误

[Sun Oct 23 12:34:37 2016] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sun Oct 23 12:34:37 2016] [warn] RSA server certificate CommonName (CN) `ip-172-55-16-165' does NOT match server name!?
[Sun Oct 23 12:34:37 2016] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sun Oct 23 12:34:37 2016] [warn] RSA server certificate CommonName (CN) `ip-172-55-16-165' does NOT match server name!?

知道我需要做什么才能正确设置ssl?

2 个答案:

答案 0 :(得分:1)

@ hjpotter92是正确的 - 配置了端口443的2个虚拟主机

当我运行以下命令时 yum install mod_ssl openssl

它使用文件ssl.conf生成文件conf.d 我还在conf / httpd.conf中有一个端口443的vhost 我在conf / httpd.conf中删除了vhost,并在conf.d / ssl.conf中配置了vhost,现在所有都正常工作了

答案 1 :(得分:1)

肯定有两个虚拟主机配置为使用{item.content}。请确认并检查您运行的Apache服务器是否已启用SNI。意味着,一个IP一个端口可用于配置多个URL和ssl证书。如果是,请提及虚拟主机中的确切网址,如下所示:

port 443

您提到的第二个错误表明基于IP的SSL证书已绑定到基于域的网站。我不确定哪个虚拟主机使用基于IP的SSL。您可以运行以下命令来检查证书内容:

VirtualHost mysite1.abc.com:443 
VirtualHost mysite2.abc.com:443 

找到使用的虚拟主机后,将证书替换为您从CA购买的证书。