I created a Private Key, CSR, and CRT using the below commands to run a Website using HTTPS on Apache 2.4.6. And the Operating System is Cent OS 7.
// To generate a Private Key
1. openssl genrsa -des3 -out www.licweb.com.key 1024
// To generate CSR
2. openssl req -new -key www.licweb.com.key -out www.licweb.com.csr
// To generate CRT
3. openssl x509 -req -days 365 -in www.licweb.com.csr -signkey www.licweb.com.key -out www.licweb.com.crt
Now, I am referencing the above created files in my httpd.conf file. But after that, when I try to RESTART Apache, I get the following error:
ERROR: SSLCertificateFile: file '/var/www/html/licweb/www.licweb.com.crt' does not exist or is empty
- The Path is correct.
- The File also Exist.
- There is even Data in the file and hence it is not empty.
[WHAT I TRIED]
I tried the following Solutions found on Google Resources:
Solution 1:
Executing command apachectl configtest which is running fine.
Solution 2:
Repairing SELinux with the below commands:
1. sudo restorecon -Rv /etc/pki/tls/certs/
2. chcon --reference=/etc/pki/tls/private/localhost.key /etc/pki/tls/private/ca.key
Solution 3:
chcon -t cert_t /etc/pki/tls/private/my.key
But none of the Solutions are working. I am still getting the same Error.
I think even the permissions are fine:
ls -l www.licweb.com.key
-rwxrwxrwt. 1 root root 963 Jul 17 10:39 www.licweb.com.key
I cannot think of any other Solution. Does anybody have any idea what is going wrong or what am I doing wrong. Any help will be highly appreciated. Thanks.
chcon -t cert_t /etc/pki/tls/private/my.key
did the trick, although I didn't see any changes in file's and its permissions which seemed OK from the start.