[英]SSL on Nginx throws error (SSL: error:0908F066:PEM routines:get_header_and_data:bad end line)
I generated my SSL from SSLforFree/ZeroSSL, and according to the steps for installation listed on their website, https://zerossl.com/help/installation/nginx/我从 SSLforFree/ZeroSSL 生成了我的 SSL,并根据他们网站上列出的安装步骤https://zerossl.com/help/installation/nginx/
cat certificate.crt ca_bundle.crt >> certificate.crt
)cat certificate.crt ca_bundle.crt >> certificate.crt
) 合并ssl on;
ssl_certificate /etc/ssl/certificate.crt;
ssl_certificate_key /etc/ssl/private.key;
sudo service nginx restart
)sudo service nginx restart
)journalctl -xe
)journalctl -xe
) 检查错误详细信息nginx: [emerg] PEM_read_bio_X509_AUX
(SSL: error:0908F066:PEM routines:get_header_and_data:bad end line)
Merging files with cat certificate.crt ca_bundle.crt >> certificate.crt
, merges the file without adding any next line character in it.使用
cat certificate.crt ca_bundle.crt >> certificate.crt
合并文件,合并文件而不在其中添加任何下一行字符。 After merging the files, open the newly created file, ie, certificate.crt, and you'll see the file structure as follows:合并文件后,打开新建的文件,即certificate.crt,你会看到文件结构如下:
-----BEGIN CERTIFICATE-----
certificate-1-text
-----END CERTIFICATE----------BEGIN CERTIFICATE-----
certificate-2-text
-----END CERTIFICATE-----
If your certificate looks like this, you can fix this by adding adding a new line character just before 5 hyphens of second begin certificate, ie, it should look as follows after editing:如果您的证书看起来像这样,您可以通过在第二个开始证书的 5 个连字符之前添加一个换行符来解决此问题,即编辑后应该如下所示:
-----BEGIN CERTIFICATE-----
certificate-1-text
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
certificate-2-text
-----END CERTIFICATE-----
I had the same problem.我有同样的问题。 What went wrong was I had a new line in between the code before the CERTIFICATE-----.
出了什么问题是我在 CERTIFICATE----- 之前的代码之间换了一行。 I fixed that it all worked fine.
我确定一切正常。 But this helped me troubleshoot.
但这帮助我解决了问题。 Thanks,
谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.