Apache SSL error ‘SSLCertificateKeyFile: file does not exist or is empty’

I recently setup a CentOS server to add in a new SSL certificate provided by RapidSSL.com. The process, as usual, went pretty smooth. I installed mod_ssl and restarted Apache. I then updated the ssl.conf file to set the paths to the primary fields I needed (DocumentRoot, ServerName, etc). Included in that are the following three values:

  • SSLCertificateFile
  • SSLCertificateKeyFile
  • SSLCertificateChainFile

I then set these to the values needed, and went to restart Apache. When I did, I got the following error:

Starting httpd: Syntax error on line 119 of /etc/httpd/conf.d/ssl.conf: SSLCertificateKeyFile: file '/etc/pki/tls/private/site.key' does not exist or is empty

The file did exist, and was readable. I tried several things, all to no avail. Then I remembered SELinux was enabled. So I ran the following command (as root):

chcon --reference=/etc/pki/tls/private/localhost.key /etc/pki/tls/private/site.key

Then Apache started fine! I hope this can help someone down the line!



Posted in Linux Tagged with: ,