Install SSL certificate on Apache webserver

The following commands are performed on commandline.

Please note: this manual may differ from your environment, depending on the Linux distribution used and your personal configurations.

When the request for your SSL certificate is completed, it will be sent to you in a zip file containing, at least, the following files:

  • The CA root certificate
  • One or more intermediate certificates
  • Your certificate
  • A readme file

The certificate will be installed on the server in the folder you indicate. While most Linux distributions use a default SSL folder, /etc/ssl/, it is recommended to create separate folders on your server where you save your certificates and your private keys. In this example, we use the folders /etc/ssl/certificates and /etc/ssl/keys.

Place your intermediate certificate and your own certificate in the certificates folder, and your private key in the keys folder.

If your SSL certificate was sent to you with multiple intermediate certificates, it is recommended to combine these into one file. This is done with the following command:
cat intermediatecert1.cer intermediatecert2.cer > intermediates.cer

Open the configuration file of the website for which the SSL certificate was requested. In this example, this file is located in /etc/apache2/sites-available/.

Add the following lines to your configuration file:
SSLEngine on
SSLCertificateFile /etc/ssl/certificaten/www.voorbeeld.nl.cer
SSLCertificateKeyFile /etc/ssl/keys/www.voorbeeld.nl.key
SSLCertificateChainFile /etc/ssl/certificaten/intermediates.cer

Save your configuration file. This will look similar to the following example: ServerName www.testomgeving.net ServerAdmin postmaster@testomgeving.net DocumentRoot /var/www/www.testomgeving.net/public ErrorLog ${APACHE_LOG_DIR}/testomgeving.error.log CustomLog ${APACHE_LOG_DIR}/testomgeving.access.log combined ServerName www.testomgeving.net ServerAdmin postmaster@testomgeving.net DocumentRoot /var/www/www.testomgeving.net/public ErrorLog ${APACHE_LOG_DIR}/testimgeving.error.log CustomLog ${APACHE_LOG_DIR}/testomgeving.access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certificaten/www.testomgeving.net.pem SSLCertificateKeyFile /etc/ssl/keys/www.testomgeving.net.key SSLCertificateChainFile /etc/ssl/certificaten/intermediate.pem

Check the syntax of your configuration with a configtest:
apachectl configtest

Restart your Apache installation with the following command:
systemctl restart apache2

Your SSL certificate has been installed. To check whether the installation was performed succesfully, you can scan your website with our Quickscan.