SSL setup on Ubuntu Apache2

To setup SSL on Apache2 on Ubuntu, please have the following files

  1. Certificate and CA certificate files
  2. Private key file

After that, put that two file in the cert folder. Recommend to put at /etc/ssl/certs/

So, copy those file like this :

cp yourdomain.com.crt yourdomain.com.bundle.crt  /etc/ssl/certs

After that, you have to locate the key file.

Put the key file on the server as /etc/ssl/private/yourdomain.com.key

Once you know the location, you modify your apache default-ssl file which is /etc/apache2/sites-available/default-ssl

<VirtualHost *:443>

  ServerName www.yourdomain.com

  DocumentRoot /var/www/YourDomainRoot

  CustomLog /var/log/apache/www.yourdomain.com-access.log combined

  ErrorLog /var/log/apache/www.yourdomain.com-error.log

  # Example SSL configuration

  SSLEngine on

  SSLProtocol all -SSLv2

  SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

  SSLCertificateFile “/etc/ssl/certs/yourdomain.com.crt”

  SSLCertificateKeyFile “/etc/ssl/private/domain.com.key”

</VirtualHost>

Note:

SSLCertificateFile tell where your crt file is located

SSLCertificateKeyFIle tell where your key file is located

You may need to use SSLCertificateChainFile or SSLCACertificateFile directive for the bundle file.

Now, you have to activate the site that you just created by :

sudo a2enmod ssl

a2ensite default-ssl

and  then reload apache2

service apache2 restart

 

SSL setup on Ubuntu Apache2