How to Fix Nginx SSL PEM_read_bio:bad end line

A week ago we migrated our Future Studio homepage and blog to a new server. Besides, we reconfigured our apps to run with SSL on HTTPS. We use a Gandi Standard SSL certificate which has the problem that an intermediate certificate is required to omit certificate errors on every browser including Android.

nginx Series Overview

Integrating the intermediate certificate and restarting nginx to work properly with the new configuration resulted in the following error during nginx restart:

(SSL: error:0906D066:PEM routines:PEM_read_bio:bad end line)

The problem: concatenation of our and the intermediate certificate didn’t join the lines in the middle properly:

-----END CERTIFICATE----------BEGIN CERTIFICATE-----

Add a line break to fix the issue:

-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----

Now you can restart nginx without hiccups.

Explore the Library

Find interesting tutorials and solutions for your problems.