我们正在办公室设置一个新的子域,并使用我们拥有的通配符 SSL 证书。我已经创建了我的密钥和 csr 文件。然后我发送到 csr 文件以获取我们现在拥有的 cer 文件。 (我将发布我进一步运行的命令)。然后,在为我们的新域使用 a2ensite 后,我将这些文件复制到 /etc/ssl/private 和 /etc/ssl/certs 文件夹中,并更新了 apache conf 文件。尝试重新启动 apache 时,显示以下错误消息:
SSL 库错误:错误:0906D06C:PEM 例程:PEM_read_bio:无起始行(预期:TRUSTED CERTIFICATE) - 文件内容或格式错误 - 甚至只是忘记了 SSLCertificateKeyFile?
到目前为止我运行过的 Bash 命令(我省略了域名):
openssl genrsa -des3 -out [domain].key 2048
openssl rsa -in star.[domain].key -out star.[domain].key.insecure
mv star.[domain].key star.[domain].key.secure
mv star.[domain].key.insecure star.[domain].key
openssl req -new -key star.[domain].key -out star.[domain].csr
当我们在创建中请求域名时,输入了 *.[domain],而不是 star.[domain],因为这是我们的提供商所要求的。
然后,我们将 csr 文件发送给我们的提供商,并收到返回的 .cer。
我将 .cer 复制到 /etc/ssl/certs/star.[domain].cer 和 /etc/ssl/private/star.[domain].key,然后更新 apache conf 文件 [subdomain].[domain]。与以下内容进行conf:
ServerAdmin IT@[domain]
ServerName [subdomain].[domain]
ServerAlias [subdomain].[domain]
SSLCertificateFile /etc/ssl/certs/star.[domain].cer
SSLCertificateKeyFile /etc/ssl/private/star.[domain].key
保存并重新启动 apache 后(服务 apache2 重新启动),我遇到了上述错误。
我最终解决了这个问题。证书以 pkcs7 格式编码,Ubuntu 不喜欢这种格式。我使用以下命令将证书转换为 PEM,现在一切都已启动并运行。
openssl pkcs7 -print_certs -in certificate.cer -out certificate.pem
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)