我有两个不同的rails网站,分别建立在ruby 1.8.x和ruby 1.9.11上。我已经使用以下代码行配置了我的/etc/httpd/conf/http.conf:
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/gems/1.8/gems/passenger-3.0.18
PassengerRuby /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby
如建议的那样 乘客安装-Apache2的模块
同样我还添加了替代替代品的进一步必要代码:
<VirtualHost *:80> ServerName www.example.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost>
一切正常,直到现在,但当我尝试为ruby 1.9.3 app添加另一个配置,并按照上面相同的过程,然后我无法同时运行ruby 1.8.7 app和1.9.3 app。后者成功运行,前者生成错误。
我使用rvm来管理这两个应用程序,并为每个应用程序分别设置gemset。
所以,我的问题是,如何同时运行我的两个应用程序。
您无法在单个乘客配置中同时运行多个ruby版本。如果是这种情况,则应该使用独立服务器运行(假设在端口4000上运行),并且应该将apache配置为在该端口上作为代理运行。有关更多信息,请参阅http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/。
乘客4允许根据应用设置PassengerRuby
。
最终版本即将推出,但同时您可以通过gem install passenger --pre
安装它。