Ubuntu – Apache SSL error: Private key not found

apache-2.2sslUbuntu

I'm running apache on Ubuntu 14.04 and trying to implement SSL. Any help would be greatly appreciated.

default-ssl.conf has:

SSLCertificateFile      /etc/apache2/ssl/domain.crt 
SSLCertificateKeyFile   /etc/apache2/ssl/domain.csr

When I restart apache, the Error message in /var/log/apache2/error.log is:

[Sun Feb 01 19:31:06.443226 2015] [ssl:error] [pid 30927] AH02203: Init: Private key not found
[Sun Feb 01 19:31:06.443408 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 01 19:31:06.443424 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 er$
[Sun Feb 01 19:31:06.443435 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 01 19:31:06.443447 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Ty$
[Sun Feb 01 19:31:06.443458 2015] [ssl:error] [pid 30927] SSL Library Error: error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib
[Sun Feb 01 19:31:06.443468 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 01 19:31:06.443479 2015] [ssl:error] [pid 30927] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Ty$
[Sun Feb 01 19:31:06.443487 2015] [ssl:emerg] [pid 30927] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more inf$

Best Answer

WARNING: Do not ever post your private key on internet. Do not even copy it to another computer, workstation etc. It must be kept as private as possible.

SSLCertificateKeyFile requires a Private Key. This key is usually generated before CSR or at the same time. Search for a file that starts with a line containing: BEGIN PRIVATE KEY

CSR (certificate signing request) is required only when you ask to sign the certificate. After that you can discard it.

If you lost the Private Key you will need to generate a new Private Key, then generate a new CSR and ask the CA (certificate authority) to sign the CSR again.