So we now have our private key
Now we need include the files in the apache config. place the .key and .crt files where you can find them (I use /etc/apache/ssl-certs/). now you need to edit your apache config file. I’ve included a dummy version below to show you what to add and where.
You will need to add ‘SSLRequieSSL’ in between the <Directory> </Directory> tags to tell apache that the content from this directory should be encrypted, you will also need to alter the port from :80 to :443
You then need to include
SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/apache/ssl-certs/www.sporticia.com.crt SSLCertificateKeyFile /etc/apache/ssl-certs/www.sporticia.com.key SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
to provide the location details for the private key and the certificate to be used.
The whole thing should look something like this
<VirtualHost 192.168.1.10:443> ServerName www.sporticia.com ServerAlias sporticia.com ServerAdmin test@sporticia.com DocumentRoot /var/www/sporticia.com <Directory /var/www/sporticia.com> SSLRequireSSL Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache/www.sporticia.com.com_error_log CustomLog /var/log/apache/www.sporticia.com_access_log common SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/apache/ssl-certs/www.sporticia.com.crt SSLCertificateKeyFile /etc/apache/ssl-certs/www.sporticia.com.key SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown </VirtualHost>
Restart Apache (using either ‘apachectl restart’ or ‘/etc/init.d/apache restart’) and you should now be able to browse the site using ‘https://sitename’ and you should have the little padlock icon to indicate the site is secured with an SSL certificate.
Note that while this will permit you to browse the site using https, it will not force the browser to https, if anyone tries to access the site using http they will get a 403 forbidden page.
Next post will show how to force the broswer to use the secure version of the site
