How do I install an SSL certificate in Apache2?
Matthew Martinez
I am pretty new to this community and I hope I put my question on the right place.
I have bought this SSL certificate, which comes with four files named like this:
AddTrustExternalCARoot.crtCOMODORSAAddTrustCA.crtCOMODORSADomainValidationSecureServerCA.crtmydomain_com
Following this guide, I end up with this error:
* Restarting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1.
Set the 'ServerName' directive globally to suppress this message
Action 'start' failed.So my apache2 service cannot even start.
Here is what i have done in /etc/apache2/sites-available/default-ssl.conf:
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin ServerName mydomain.com ServerAlias DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/mydomain_com.ca-bundle.crt SSLCertificateKeyFile /etc/apache2/ssl/mydomain.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost>
</IfModule>After I made these changes and tried to restart my apache service, I got the error shown above. These are the only changes I have done. I have not changed anything else.
Here is the error log report:
[Wed Jul 01 16:05:47.436945 2015] [mpm_prefork:notice] [pid 10568] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.9 OpenSSL/1.0.1f configured -- resuming normal operations
[Wed Jul 01 16:05:47.436988 2015] [core:notice] [pid 10568] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jul 01 16:17:27.699364 2015] [mpm_prefork:notice] [pid 10568] AH00169: caught SIGTERM, shutting down
[Wed Jul 01 16:17:28.754414 2015] [ssl:warn] [pid 10729] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Jul 01 16:17:28.754465 2015] [ssl:warn] [pid 10729] AH01909: RSA certificate configured for mydomain.com:443 does NOT include an ID which matches the server name
[Wed Jul 01 16:17:28.754485 2015] [ssl:emerg] [pid 10729] AH02238: Unable to configure RSA server private key
[Wed Jul 01 16:17:28.754510 2015] [ssl:emerg] [pid 10729] SSL Library Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
[Wed Jul 01 16:17:28.754514 2015] [ssl:emerg] [pid 10729] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
[Wed Jul 01 16:20:56.686346 2015] [ssl:warn] [pid 10920] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Jul 01 16:20:56.686411 2015] [ssl:warn] [pid 10920] AH01909: RSA certificate configured for mydomain.com:443 does NOT include an ID which matches the server name
[Wed Jul 01 16:20:56.686425 2015] [ssl:emerg] [pid 10920] AH02238: Unable to configure RSA server private key
[Wed Jul 01 16:20:56.686441 2015] [ssl:emerg] [pid 10920] SSL Library Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
[Wed Jul 01 16:20:56.686446 2015] [ssl:emerg] [pid 10920] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more information
[Wed Jul 01 16:46:22.422767 2015] [ssl:warn] [pid 11024] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Jul 01 16:46:22.422831 2015] [ssl:warn] [pid 11024] AH01909: RSA certificate configured for mydomain.com:443 does NOT include an ID which matches the server name
[Wed Jul 01 16:46:22.422844 2015] [ssl:emerg] [pid 11024] AH02238: Unable to configure RSA server private key
[Wed Jul 01 16:46:22.422858 2015] [ssl:emerg] [pid 11024] SSL Library Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
[Wed Jul 01 16:46:22.422862 2015] [ssl:emerg] [pid 11024] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/error.log for more informationIf it is important, I have generated my key with openssl.
Note that I have replaced my real domain name and adress with mydomain.com for this question.
Can you please give me step by step guide how can i install this certificate on Ubuntu 14.04 with apache2.
41 Answer
You need to add this line, where yourDomainName.ca-bundle should be prefferably a .crt file you obtained from Comodo:
SSLCertificateChainFile /etc/ssl/into the /etc/apache2/sites-available/default-ssl.conf
Source: