Installing SSL certificate causes the server to fail when restarting
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.
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.
# 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