简体   繁体   English

Nginx 上的 SSL 抛出错误(SSL:错误:0908F066:PEM 例程:get_header_and_data:结尾行错误)

[英]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/

  1. Downloaded the SSL Files下载了 SSL 个文件
  2. Moved them to the Server将它们移动到服务器
  3. Merged the certificate.crt & ca_bundle.crt with ( cat certificate.crt ca_bundle.crt >> certificate.crt )将 certificate.crt 和 ca_bundle.crt 与 ( cat certificate.crt ca_bundle.crt >> certificate.crt ) 合并
  4. Added following lines in the hosts file of nginx:在 nginx 的主机文件中添加了以下行:
    ssl on;
    ssl_certificate /etc/ssl/certificate.crt;
    ssl_certificate_key /etc/ssl/private.key;
  5. Restarted Nginx Server with ( sudo service nginx restart )重新启动 Nginx 服务器( sudo service nginx restart
  6. Error received, and checked the error details by ( journalctl -xe )收到错误,并通过 ( journalctl -xe ) 检查错误详细信息
  7. Error was:错误是:
    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.

相关问题 Nginx SSL握手错误 - Nginx SSL Handshake Error ssl.c:510: 错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE: 证书验证失败 - ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 错误:RPC失败; curl 56 OpenSSL SSL_read:错误:140943FC:SSL例程:ssl3_read_bytes:sslv3警报错误记录mac,errno 0 - error: RPC failed; curl 56 OpenSSL SSL_read: error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac, errno 0 Nginx SSL子域错误 - nginx ssl subdomain error pyodbc.OperationalError:('08001','[08001] [Microsoft] [SQL Server 的 ODBC 驱动程序 18]SSL 提供程序:[错误:1416F086:SSL 例程:tls_process_server_ce - pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:1416F086:SSL routines:tls_process_server_ce 问题 curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version - Problem curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version 主机名中的ssl错误 - ssl error in the hostname ASP.NET 内核。 System.Data.SqlClient.SqlException - SSL_ERROR_SSL - ASP.NET Core. System.Data.SqlClient.SqlException - SSL_ERROR_SSL Apache 2.4中的SSL证书错误 - SSL Certificate error in Apache 2.4 Python SSL导入错误 - Python SSL import error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM