web analytics

Howto configure SSL support for Apache web server

The Apache web server supports SSL for secure HTTP browsing. SSL allows the encryption of all HTTP communications between the browser and the web server using public key cryptography. This howto explains how to add SSL support to the Apache web server.

Prepare SSL certificates

Edit httpd.conf

httpd.conf is the Apache configuration file. We need to load the Apache SSL modules.

LoadModule ssl_module         libexec/apache/libssl.so
AddModule mod_ssl.c

And create a VirtualHost entry for each hosted domain. For example, for the domain example.com, we would add


DocumentRoot "/usr/local/www/website-root"
ServerName example.com
ServerAdmin you@example.com
ErrorLog /var/log/httpd-error.log
TransferLog /var/log/httpd-access.log
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars

<Directory "/usr/local/www/website-root/cgi-bin">
    SSLOptions +StdEnvVars

You could leave a comment if you were logged in.