Fixing [emerg] PEM_read_bio_X509_AUX Error When Installing SSL Certificate

Some weeks ago, I was installing an SSL certificate and when I thought I was finish, NGINX refused to start. I got the error, “nginx: [emerg] PEM_read_bio_X509_AUX(“/usr/local/nginx/conf/ssl/sslcert.crt”…d end line)” after I restarted the web server to make the SSL changes take effect. Of course, your sslcert.crt file might be named differently, but we’ll use this name this time.

This guide helps you fix this error if you ever encounter it.

Note: Hostname and date have been edited out.

systemd[1]: Stopped SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
nginx[12781]: Starting nginx: nginx: [emerg] PEM_read_bio_X509_AUX("/usr/local/nginx/conf/ssl/sslcert.crt"...d end line)
host.domain.com nginx[12781]: [FAILED]
systemd[1]: nginx.service: control process exited, code=exited status=1
systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
systemd[1]: Unit nginx.service entered failed state.
systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

This is likely because your sslcert.crt file (the SSL certificate.. it will be named differently for you) missed the extra line

Open sslcert.crt (rename if you can’t edit it) and look for:

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

Add a line break so it looks like:

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

Save and restart your web server. That should fix the issue and your SSL certificate should be installed.