我有一个简单的 Rails 3.1.rc6 应用程序,我用它来尝试在我的测试服务器(OS X 10.7 服务器)上测试 SSL 配置。我正在使用 Phusion Passenger 和 Apache。
不使用 SSL 时,我可以毫无问题地运行该应用程序。当我通过 Apache 或通过config.force_ssl = true
我的environments/production.rb
文件启用 SSL 时,页面加载时不会出现错误,但它大部分是空的,而且不是我的站点。看起来好像它正在尝试从空目录中提供文件。
我检查了配置 SSL 的 Edge Rails 文档,它只提到添加config.force_ssl = true
选项,说这将自动使用 Rack::SSL 中间件。
当我加载页面时,我看到:
Index of /
Name Last modified Size Description
Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8r DAV/2 Phusion_Passenger/3.0.8 Server at mysite.mydomain.com Port 443
如果我删除 rails 应用程序中的 ssl 配置行并使用服务器工具强制站点使用 SSL(选择自签名证书进行测试),则会发生完全相同的事情。我需要更改哪些内容才能使其服务于... myapp/current/public
文件夹,就像我拥有时一样config.force_ssl = false
?
编辑:更多信息。我看到以下内容/var/log/apache2/error_log
:
[Fri Aug 26 10:57:49 2011] [notice] caught SIGTERM, shutting down
[Fri Aug 26 10:57:50 2011] [warn] RSA server certificate CommonName (CN) `My-Mac-mini.local' does NOT match server name!?
...
[Fri Aug 26 10:57:50 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
httpd: Could not reliably determine the server's fully qualified domain name, using myserver.local for ServerName
[Fri Aug 26 10:57:50 2011] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
[Fri Aug 26 10:57:50 2011] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
[Fri Aug 26 10:57:50 2011] [warn] RSA server certificate CommonName (CN) `My-Mac-mini.local' does NOT match server name!?
...
[Fri Aug 26 10:57:50 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Fri Aug 26 10:57:50 2011] [notice] Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8r DAV/2 Phusion_Passenger/3.0.8 configured -- resuming normal operations
cache: [GET /] miss