nginx SSL PEM_read_bio:bad end line

Installing the intermediate certificates on our server gave me the following error while trying to start up nginx again:

The end of the file looked fine, but the problem was half way through it. Somehow the concatenation had joined two lines together:

This just needed a line break to fix:

  1. Saved me a lot of time that could be wasted because i did the same with one BIG mistake, somehow i thought that:


    Should be (*another ‘-‘ after END CERTIFICATE…):


    The first one is correct BTW as it says in the post.

  2. For me this was more sinister, using cat on files of which one is CRLF and the other has LF linefeeds causes the line ending problem described above. You should sanitise the certificates first with dos2unix and then use cat, it will save you a lot of time.

Leave a Reply to Dong-in Yim Cancel reply

Your email address will not be published.