First of all, you need to install the application on the server.
aptitude install apache2
Then, you need to activate the ssl module (we will reload Apache later):
a2enmod ssl
Next, make sure that Apache listens on the HTTPS port. In the file /etc/apache2/ports.conf, add:
<IfModule mod_ssl.c> Listen 443 NameVirtualHost YOUR_IP_ADDRESS:443 </IfModule>
…if it is not already present.
So that your certificate can be recognized as having been issued by an approved certification authority, you need to recover the intermediary certificates issued by Gandi: Retrieving the Gandi intermediate certificate
Install your keys/certificates and any necessary intermediary certificates (to form a string) in, for example: /etc/ssl
cp cert-domain.tld.crt /etc/ssl/certs/domain.tld.crt cp myserver.key /etc/ssl/private/domain.tld.key cp GandiXXXSSLCA.pem /etc/ssl/certs/GandiXXXSSLCA.pem
To add a domain name to your secure Apache, create a dedicated website:
vi /etc/apache2/sites-available/000-domain.tld-ssl
…and add the virtualhost of your domain in the following manner:
<VirtualHost YOUR_IP_ADDRESS:443> ServerName www.domain.tld ServerAlias domain.tld DocumentRoot /var/www/www.domain.tld/ CustomLog /var/log/apache2/secure_access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/domain.tld.crt SSLCertificateKeyFile /etc/ssl/private/domain.tld.key SSLCertificateChainFile /etc/ssl/certs/GandiXXXSSLCA.pem SSLVerifyClient None </VirtualHost>
Then activate the SSL website by reloading Apache:
a2ensite 000-domain.tld-ssl /etc/init.d/apache2 reload
With 2.4.8, Apache has deprecated the SSLCertificateChainFile directive
, and you may receive the error
The SSLCertificateChainFile directive is deprecated, SSLCertificateFile should be used instead.
The new method is as follows:
GandiStandardSSLCA.pem
), and open it in a text editor. mydomain.com.crt
. This should be the same file indicated on the SSLCertificateFile
line of your VirtualHost block.SSLCertificateChainFile
. The file referenced by SSLCertificateFile
now contains both certificates, so commenting out the chain file is all you need to do.Using the following openssl command with your IP address (or the hostname of the server) and the associated port of the service (443 in case of apache2/SSL) :
openssl s_client -connect ip.ip.ip.ip:port
Or you can use http://www.digicert.com/help/ to visualize the chain on a more graphical way.