介绍如何在apache 安装配置SSL证书,以及相关注意事项
准备所需文件
安装SSL证书到Apache服务器上, 我们需要3个文件,登陆帐号 ,点击左侧 我的证书
,进入你的证书详情页去下载证书,解压后有一个 apache 文件夹,里面有这2个文件,分别是 服务器证书 server.crt 和中级证书 ca.crt 。第三个需要的文件是私钥,这是你提交订单前生成CSR的时候生成的,如果你在提交订单时候选择系统生成CSR的,请检查邮箱,有一封邮件主题是 "订单编号xxxx的CSR和私钥"的邮件,下载server.key 这个附件,这个文件就是私钥。
(1) . 服务器证书 server.crt;
(2) . 中级证书 ca.crt;
(3) . 私钥(Key) server.key;
配置Apache
参考下面的代码,在Apache目录下的 httpd.conf 文件增加一个虚拟主机
<VirtualHost *:443>
...
SSLEngine on
SSLCertificateKeyFile /etc/ssl/server.key
SSLCertificateFile /etc/ssl/server.crt
SSLCertificateChainFile /etc/ssl/ca.crt
SSLProtocol All -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
........</VirtualHost>
然后保存。重启Apache
/etc/init.d/httpd restart