【发布时间】:2011-01-04 10:33:18
【问题描述】:
我有一个带有“Snow Leopard”v10.6.5 的 Mac OS,我正在使用 Passenger Preference Pane v 1.3 开发一个 Ruby on Rails 3 应用程序。
要继续开发我的应用程序,我需要 SSL 支持,但我有类似的problem。
我遵循的步骤来自默认的 apache osx 安装:
- 安装乘客和乘客首选项窗格。
- 添加我的 Ruby on Rails 应用程序(有效)
- 将我的 ca.key、server.crt 和 server.key 创建为 detailed on the Apple website...
...但是在第三步中,由于以下原因,我不得不停止编辑 /private/etc/apache2/httpd.conf 文件(有关更多信息,请参阅 Apple 网站) :
1。
Port 80 should be changed to #Port 80.
我没有找到“80端口”,但我认为这不是问题,因为即使它存在于代码中,也已经被注释掉了。
2。
You will need to add the following just below where the Port directive was:
< IfModule mod_ssl.c>
Listen 443
Listen 80
< /IfModule>
如果我添加这些代码行并重新启动 apache2,我的应用程序将不再工作。
3。
[...] The two lines should now look like this:
LoadModule ssl_module libexec/httpd/libssl.so
AddModule mod_ssl.c
由于代码“AddModule mod_ssl.c”不存在(LoadModule 已准备好使用),我尝试添加它并重新启动 apache2,但我的应用程序不再工作。
4。
Now find the “ServerName” directive and make sure it has 127.0.0.1 for it’s entry.
ServerName 127.0.0.1
我不知道我是否必须输入它,因为我使用乘客。但是,在文件中,我找到了代码行(已注释)'#ServerName www.example.com:80'。
关于 SSL 证书的Passenger 代码,我想它必须与problem reported above 相同。
我认为这是因为指南是很久以前写的。那么,我应该怎么做才能将 SSL 与 apache2 一起使用?
为了清楚起见,我还包括与乘客偏好窗格相关的代码...
.../private/etc/apache2/httpd.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
PassengerRuby /usr/local/bin/ruby
# Added by the Passenger preference pane
# Make sure to include the Passenger configuration (the LoadModule,
# PassengerRoot, and PassengerRuby directives) before this section.
<IfModule passenger_module>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName _default_
</VirtualHost>
Include /private/etc/apache2/passenger_pane_vhosts/*.conf
</IfModule>
.../private/etc/apache2/passenger_pane_vhosts/subdomain.domain.com.vhost.conf
<VirtualHost *:443>
ServerName subdomain.domain.com
DocumentRoot "/Users/<my_user_name>/Sites/subdomain/public"
RackEnv development
<Directory "/Users/<my_user_name>/Sites/subdomain/public">
Order allow,deny
Allow from all
</Directory>
# SSL Configuration
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLOptions +FakeBasicAuth +ExportCertData +StdEnvVars +StrictRequire
#Self Signed certificates
SSLCertificateFile /private/etc/apache2/ssl/server.crt
SSLCertificateKeyFile /private/etc/apache2/ssl/server.key
SSLCertificateChainFile /private/etc/apache2/ssl/ca.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>
【问题讨论】:
-
您在 Apple 网站上关注的文档已有大约 10 年的历史,并且针对的是 Apache 1.3,因为当时安装了 Mac OS X。这些说明不会完全适用于当前的 Apache 2.2 安装。请改用 Apache 文档。
标签: macos ssl apache2 ruby-on-rails-3 passenger