We have generated a certificate via Letsencrypt and trying to use it via nginx, but we get a weird error:
cannot load certificate "/home/path/site.pem": PEM_read_bio_X509_AUX() failed
The solution we found was to add a space infront of the certificate (notice the space infront of the cert) (also note that i have changed the content of the cert for security).
-----BEGIN CERTIFICATE-----
MIIF8DCCBNigAwIBAgISA08f2YsQTxMkdjKqHcKSZcDEMA0GCSqGSIb3DQEBCwUAMDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJSMzAeFw0yMzA2MjgwMDQ0NDNaFw0yMzA5MjYwMDQ0NDJaMBwxGjAYBgNVBAMMESoubGVhcm5kYXNoLnRvZGF5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvrp8IieMP7x5ipbZdJs8EcN0xoxQCWOcBnpaa8zFBpr+TAgLjayVDfQPPFyaYoM+0PFWduJRJDfGBl9VIMsACmX2NlvI6LPolA3Zsg73Ud/Ph2o5KD0cSDNFQfa+HLXVUojaxTrS3bjrz5jSPzNN/S3Vopk/NQqqq3eW0Jho9ljpMbg7JYM9c+cRFCw2gObW8LhqXrXewK9CqaFcvYee4tj1UbpJlOk9C9GrWyKI7rJI8U2DGlqNDcwyUDkRcKDafhHShyFs9sqEN0kbYNo55rcOQRGg1uaX7wd2brk5YpZCK5kh7X7hFC4M/FSY1/xttdF5e3A/5ShSPXW1iGHqxLaoLsqvUwyjdC2KChluZhRLT3/Of9YPCeI1rxfa28g4dhRCFCfLaaNoP8gB8Xcn+QY7nDqcBDFXexz1L4ZDuWyeM6bkPC9NXcju191kEhto1+XaeS47Qil6cK2KM5l1rRICmjefQ85Ab70HhI4dizasQsgYwFxr0QootdCZwY8ClG7OnkwK5VDMCSL9DHmxa1wk0HImDBMHFmFddnOH8drdJZAONPURSOSEjAIBgZngQwBAgEwggEFBgorBgEEAdZ5AgQCBIH2BIHzAPEAdwC3Pvsk35xNunXyOcW6WPRsXfxCz3qfNcSeHQmBJe20mQAAAYj/rKDmAAAEAwBIMEYCIQCtXVPX7lEJgkDFoLsjAA2pVZ4R3m7uXrm+9Asp5ZFKPAIhAOMtsg4A0G5xoA2Up04IVq+0so36YvXpRU9CBbCtZ7inAHYAejKMVNi3LbYg6jjgUh7phBZwMhOFTTvSK8E6V6NS61IAAAGI/6yg/QAABAMARzBFAiEAsEMA4hxNWAMdrgQBTgQ54XN7psKOHBOpJO36C+q4WogCIAIn8kRkYvJAXaHvVb840XvnTxEFrvbrKWA9Y39NecQOMA0GCSqGSIb3DQEBCwUAA4IBAQBJ3ObgDYzkHAGo3raH2etRUlvlNbF4WAe2OwKVDCPEqsNdhN+phm6frGqcYJMnbqtxafFOwfwp5tsFjV24XUA4I/Q9xasQXQWGylMIngddwzV9ygZBatWQgAxw/VHhc9lGsx9nb+3nN6qfGmZeLyEvjqFIwmCIIlBkv80HY6Rxo1HsrieAGMEuZuzIaiW9pqjZfVquU0b/K0DNeDlHUPeVSngl/XD8WzQeUJqVrNAiaIwgt/q1CRfZkXUSGUO4xAm8fWgjPrvcd8xgBEsU5JTTdQv2NJr4qP58UTgmxw5+aIiZhvzd9uLmYirdn5b3EGib8sGrkDbg9OCCrg6qj6Cf
-----END CERTIFICATE-----
What is wrong with the cert, why does it work after adding a space?