Sorin Buturugeanu
Sorin Buturugeanu

Reputation: 1840

Adding SSL to my website

I have the following virtual hosts config:

listen 80
listen 443
servername "example.com"
serveradmin "email@example.com"
namevirtualhost *:80
namevirtualhost *:443

directoryindex  index.html index.php
options -indexes -multiviews +followsymlinks

<directory /Volumes/dev1/http>
    allowoverride all
</directory>

<virtualhost *:80 *:443>
    servername example.com
    serveralias www.example.com
    documentroot "/Volumes/dev1/http/example"
    rewriteengine on
    SSLCertificateFile "/Volumes/dev1/ssl/_ssl-cert.crt"
    SSLCertificateKeyFile "/Volumes/dev1/ssl/_ssl-privatekey.crt"
    SSLCertificateChainFile "/Volumes/dev1/ssl/_ssl-csr.crt"
</virtualhost>

Of course example.com is just an ... example.

All is well if I access http://example.com, but if I try to access the HTTPS version I get

Safari can’t open the page “https://example.com/” because Safari
can’t establish a secure connection to the server “example.com”.

The _ssl* files are all in place and running httpd -t from Terminal returns Syntax OK.

What am I doing wrong? Thanks!

Upvotes: 0

Views: 679

Answers (1)

Lior Cohen
Lior Cohen

Reputation: 9055

This what I'm using (only the vhosts section), omitting the FCGID, suexec and PHP specific parts:

    <VirtualHost *:80>
      ServerName example.com
      DocumentRoot "/var/www/example.com/htdocs"
      <Directory "/var/www/example.com/htdocs/">
        Options -Indexes
        AllowOverride All
        Order allow,deny
        Allow from All
      </Directory>

      ErrorLog "/var/www/example.com/error.log"
      CustomLog "/var/www/example.com/access.log" combined
    </VirtualHost>

    <VirtualHost *:443>
      ServerName example.com
      DocumentRoot "/var/www/example.com/htdocs"
      <Directory "/var/www/example.com/htdocs/">
        Options -Indexes
        AllowOverride All
        Order allow,deny
        Allow from All
      </Directory>

      SSLEngine on
      SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
      SSLCertificateFile /etc/apache/ssl/example.com.crt
      SSLCertificateKeyFile /etc/apache/ssl/example.key
      SSLCertificateChainFile /etc/apache/ssl/gd_bundle.crt

      ErrorLog "/var/www/example.com/error.log"
      CustomLog "/var/www/example.com/access.log" combined
    </VirtualHost>

Upvotes: 1

Related Questions