我在 Apache 2.4.12 上,所以SSLCertificateChainFile现在已经过时了,任何中间证书都应该包含在服务器证书文件中。但是,我无法弄清楚如何执行此操作 - 除了指定文件中的站点证书之外的任何证书组合都会导致无效密钥错误。如何在使用SSLCertificateFile指定的文件中正确包含中间证书?
2 回答
取自 Apache 2.4 模块mod_ssl
文档:
这些文件还可能包括从叶到根排序的中间 CA 证书。版本 2.4.8 及更高版本支持此功能,并且已过时
SSLCertificateChainFile
.
这意味着该SSLCertificateFile
指令现在(2.4.8 之后)接受具有完整证书链(从叶到根)的文件。如果你有你的服务器证书domain.crt
和 CA 链文件domain-ca.crt
,你需要将两个文件从叶子连接到根,即从你的服务器证书开始,如
cat domain.crt domain-ca.crt > bundle.crt
并在您网站的文件中使用该conf
文件:
SSLCertificateFile /path/to/bundle.crt
(例如,使用 Ubuntu 默认路径,这些文件将存储在/etc/apache2/ssl/
.)
对于 Apache 2.4.8,SSLCertificateChainFile
已过时。但是,它只是 deprecated 并没有 remove,因此您可以继续使用旧样式。但是,对于 Apache 版本 > 2.4.8,SSLCertificateChainFile
将不起作用。
SSLCertificateChainFile 已弃用
SSLCertificateChainFile 在 2.4.8 版中已过时,当时 SSLCertificateFile 被扩展为也从服务器证书文件加载中间 CA 证书
来源:https ://httpd.apache.org/docs/2.4/mod/mod_ssl.html#SSLCertificateChainFile
旧样式(在 Apache <= 2.4.8 上有效)
#SSL Directives
SSLEngine on
SSLCertificateFile /etc/ssl/certs/<mydomain.com>.crt
SSLCertificateKeyFile /etc/ssl/private/<mydomain.com>.key
SSLCertificateChainFile /etc/ssl/certs/<full-chain-bundle>.crt
新样式(在 Apache >= 2.4.8 上有效)
#SSL Directives
SSLEngine on
SSLCertificateFile /etc/ssl/certs/<full-chain-bundle>.crt
SSLCertificateKeyFile /etc/ssl/private/<mydomain.com>.key
来源: https ://codesport.io/lamp-stack-advanced/lets-encrypt-tutorial/#vhost-config