Installing SSL certificate causes the server to fail when restarting Installing SSL certificate causes the server to fail when restarting apache apache

Installing SSL certificate causes the server to fail when restarting


Another possible source of failure which causes this errror message is:Instead of the certificate file I linked to the certification request file. It's recognizable when you read the first line of the file:Either

-----BEGIN CERTIFICATE REQUEST-----

Or

-----BEGIN CERTIFICATE-----    

:-)


Situation: Apache 2.4 using the StartSSL cert generating ASN encoding error

Issue:

AH02564: Failed to configure encrypted (?) private key <domain>.com:80:0, check /etc/pki/tls/certs/ssl.key

Some SSL issuers encrypts the ssl key files by default so make sure decrypt it at the server and point it from Virtual Host.

Simply echo the key file to make sure it is not encrypted.

enter image description here

Decrypt the key file for the mod_ssl

openssl rsa -in ssl.key -out ssl.key

For SSL config in the Apache conf (httpd.conf) add the following configurations and restart the Apache.

enter image description here

# SSL<VirtualHost *:443>    ServerName gajen.com    SSLCertificateKeyFile /etc/pki/tls/certs/ssl.key    SSLCertificateFile /etc/pki/tls/certs/ssl.crt    SSLCertificateChainFile /etc/pki/tls/certs/root.ca.pem</VirtualHost>

For troubleshooting:

  • Debug the Apache first tail 50 /var/log/httpd/error_log
  • Debug the mod_ssl tail 50 /var/log/httpd/ssl_error_log


In my case I had the certificates mixed: SSLCertificateFile had the private_key and SSLCertificateKeyFile had the cert.