Apache fails to start due to: Failed to configure encrypted (?) private key

August 3, 2023 /

In this tutorial, we’ll explain how Apache fails to start due to:

When Apache is not running and you see the following error is logged to the Apache error log. (/etc/apache2/logs/error_log) when Apache fails to start:

[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

Description: This happens while using the SSLCertificateFile directive with an invalid path in a custom Apache that includes a configuration file.

Example:

# cat /etc/apache2/conf.d/userdata/ssl/2_4/cpaneluser/domain.tld/includefile.conf
SSLCertificateFile /etc/pki/tls/certs/hostname.domain.tld.crt

Workaround: As default, Apache’s configuration contains an SSLCertificateFile directive for each domain. If you want to confirm then run the following command:

# grep 'SSLCertificateFile' /etc/apache2/conf/httpd.conf

To resolve this kind of issue, remove the SSLCertificateFile directive from the custom. Apache which includes a configuration file, or comment out the directive by adding a ‘#’ to the front of the line the directive is on. Once it is completed, run the following scripts to load the change and to start Apache: 

/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd

For more help with your hosting, visit our bodHOST Knowledgebase.

Leave a Reply

Your email address will not be published. Required fields are marked *