2012-05-12 53 views
0

我有以下的虛擬主機配置:添加SSL到我的網站

listen 80 
listen 443 
servername "example.com" 
serveradmin "[email protected]" 
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> 

當然example.com的是隻是一個...的例子。

一切都很好,如果我訪問http://example.com,但如果我嘗試訪問HTTPS版本我得到

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

_ssl*文件全部到位,並從終端運行httpd -t返回Syntax OK

我在做什麼錯?謝謝!

+0

哪裏是你的LoadModule行?這不能是你的整個httpd.conf文件(我希望)。 –

回答

1

這就是我使用(只有虛擬主機部分),省略FCGID,suexec的和PHP特定部分:

<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>