Centos – Why do apache SSL certificate and key need to be in /etc/pki/tls/private/

apache-2.2centosssl-certificate

I have an Apache 2.2 web server running on CentOS 6.6. I have a certificate and key file that functions when the files are in this directory:

SSLCertificateFile "/etc/pki/tls/private/certs/mycert.crt"
SSLCertificateKeyFile "/etc/pki/tls/private/mycert.key"

but it fails when the same files are in a different directory

drwxr-xr-x. 2 root root 4096 Apr  8 16:41 ssl

SSLCertificateFile "/etc/ssl/mycert.crt"
SSLCertificateKeyFile "/etc/ssl/mycert.key"

The apache error logs contain

[error] Init: Private key not found

SELinux is disabled. What would cause behavior like this?


UPDATE

The permissions for the files are the same in both directories:

-rw-r--r--  1 root root 2253 Apr  8 16:40 mycert.crt
-rw-------  1 root root 1675 Apr  8 16:40 mycert.key

Best Answer

apache runs under apache user, not root, and you limited acces to root user only maybe? So try "chown apache /etc/ssl/mycert.key". It is very obvious, but you did not mention it, so just suggesting.