我们正在办公室设置一个新的子域并使用我们拥有的通配符 SSL 证书。我已经创建了我的 key 和我的 csr 文件。然后我发送到 csr 文件以获取我现在拥有的 cer 文件。 (我将发布我进一步运行的命令)。然后我将文件复制到/etc/ssl/private 和/etc/ssl/certs 文件夹中,并在为我们的新域使用 a2ensite 后更新了 apache conf 文件。尝试重新启动 apache 时,显示以下错误消息:
SSL 库错误:error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten 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].[域].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 后(service apache2 restart),出现上述错误。
最佳答案
我最终解决了这个问题。证书以 pkcs7 格式编码,Ubuntu 不喜欢这种格式。我使用以下命令将证书转换为 PEM,现在一切都已启动并运行。
openssl pkcs7 -print_certs -in certificate.cer -out certificate.pem
关于ubuntu - SSL 证书不工作 - "no start line"错误 - Apache2 Ubuntu 16.04.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39015967/