当我尝试在Firefox中加载https版本的网站时,出现“无法连接”错误消息。
日志文件中没有错误信息,只有:
[Thu Dec 09 16:55:24 2010] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Thu Dec 09 16:55:25 2010] [notice] Digest: generating secret for digest authentication ... [Thu Dec 09 16:55:25 2010] [notice] Digest: done [Thu Dec 09 16:55:26 2010] [notice] Apache/2.2.16 (FreeBSD) mod_ssl/2.2.16 OpenSSL/0.9.8n DAV/2 PHP/5.3.3 with Suhosin-Patch configured -- resuming normal operations
我遵循本指南: http : //www.akadia.com/services/ssh_test_certificate.html
我的configuration文件如下所示:
<Directory "/usr/local/www/apache22/data"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> NameVirtualHost *:443 <VirtualHost *:443> DocumentRoot "/usr/local/www/apache22/data" ServerName "domain.name" SSLEngine on SSLCertificateFile /some-folder/ssl-key/server.crt SSLCertificateKeyFile /some-folder/ssl-key/server.key CustomLog "/some-folder/log/httpd-ssl_request.log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/usr/local/www/apache22/data" ServerName "domain.name" </VirtualHost>
(编辑一小部分,但你应该能够看到我做了什么对错…)
默认情况下,Apache不监听端口443(用于SSL通信的端口)(据我所知)。 因此,为了能够连接到新configuration的SSL服务器,您需要在configuration中包含以下行:
Listen 443
configuration虚拟主机不会自动使服务器侦听configuration中指定的端口。