分类:
安装SSL证书到Apache ,我们需要3个文件
server.key 私钥
server.crt 服务器证书
ca.crt 中级证书
开始安装
打开 apache 安装目录下 conf 目录中的 httpd.conf 文件,
找到
#LoadModule ssl_module modules/mod_ssl.so
(如果找不到请确认是否编译过 openssl 插件)
找到
#Include conf/extra/httpd_ssl.conf
删除行首的配置语句注释符号“#”,保存退出
复制一份要安装SSL证书的虚拟主机的配置代码 ,
<VirtualHost *:80>
...
….
</VirtualHost>
...
….
</VirtualHost>
做相应的修改,下面代码中的加粗部分是SSL证书配置需要的代码。
<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>
..
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>
其中
server.key 是私钥 (key)
server.crt 是服务器证书
ca.crt 是中级证书
server.crt 是服务器证书
ca.crt 是中级证书
然后保存,重启apache 。
/etc/init.d/httpd restart
- 上一篇: nginx 安装SSL证书 升级到HTTPS
- 下一篇: tomcat 安装SSL证书