Fixing Apache SSL Startup Error

If Apache fails to start because of an issue with an encrypted private key, you might encounter the following error in the Apache error log (/etc/apache2/logs/error_log) when attempting to start Apache:

[ssl:emerg] [pid 2229] AH02312: Fatal error initialising mod_ssl, exiting.
[ssl:emerg] [pid 2229] AH02564: Failed to configure encrypted (?) private key
domain.tld:443:1, check /etc/pki/tls/certs/hostname.domain.tld.crt
AH00016: Configuration Failed

This problem arises when using the SSLCertificateFile directive with an incorrect path in a custom Apache configuration file.

For instance, in the file /etc/apache2/conf.d/userdata/ssl/2_4/cpaneluser/domain.tld/includefile.conf:
SSLCertificateFile /etc/pki/tls/certs/hostname.domain.tld.crt

To fix this, you can follow these steps:

Check if the SSLCertificateFile directive is present in the custom Apache configuration:
grep ‘SSLCertificateFile’ /etc/apache2/conf/httpd.conf

To resolve the issue, remove or comment out the SSLCertificateFile directive in the custom Apache configuration file.

Example: #SSLCertificateFile /etc/pki/tls/certs/hostname.domain.tld.crt

After making the changes, run the following commands to apply the modifications and restart Apache:

/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd

For additional assistance with your hosting, you can refer to our host.co.in Knowledgebase.