happypeter / auth-love

source code for happypeter.org
happypeter.org
7 stars 2 forks source link

网站打不开了,应该是 passenger 处理多个 ruby 的问题 #6

Open happypeter opened 10 years ago

happypeter commented 10 years ago

报错

It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:

bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:

Is this app supposed to be run as the peter user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------

Could not find rake-0.9.2.2 in any of the sources (Bundler::GemNotFound)
happypeter commented 10 years ago
bundle&&restart tmp/restart.txt 

made no effect.

happypeter commented 10 years ago

使用了下面的配置

<VirtualHost *:80>
  LoadModule passenger_module /home/peter/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
  <IfModule mod_passenger.c>
    PassengerRoot /home/peter/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/passenger-4.0.37
    PassengerDefaultRuby /home/peter/.rbenv/versions/1.9.3-p125/bin/ruby
  </IfModule>
   ServerName happypeter.org
   DocumentRoot /home/peter/auth-love/public/
   <Directory /home/peter/auth-love/public/ >
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

打开网站错误是没有了,却成了这个样子

screen shot 2014-07-09 at 11 43 23 am

happypeter commented 10 years ago
<VirtualHost *:80>
   ServerName www.happypeter.org
   PassengerDefaultRuby /home/peter/.rbenv/versions/1.9.3-p125/bin/ruby
   DocumentRoot /home/peter/auth-love/public/
   <Directory /home/peter/auth-love/public/ >
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

改成这样,灵了

happypeter commented 10 years ago
<VirtualHost *:80>
   ServerName happycasts.net
   DocumentRoot /home/peter/happycasts/public/
   <Directory /home/peter/happycasts/public/ >
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

也不是用的 httpd.conf 开头指定的 ruby 2.0

</VirtualHost>
 LoadModule passenger_module /home/peter/.rbenv/versions/2.0.0-dev/lib/ruby/gems/2.0.0/gems/passenger-4.0.36/buildout/apache2/mod_passenger.so
 <IfModule mod_passenger.c>
   PassengerRoot /home/peter/.rbenv/versions/2.0.0-dev/lib/ruby/gems/2.0.0/gems/passenger-4.0.36
   PassengerDefaultRuby /home/peter/.rbenv/versions/2.0.0-dev/bin/ruby
 </IfModule>

但是也是一样可用工作呀,不过保险起见,我还是加上吧

happypeter commented 10 years ago

每个 virtualhost 里面千万别用 PassengerDefaultRuby !!!

PassengerDefaultRuby 这个会覆盖最开头的 PassengerDefaultRuby 的设置,从而全局的改变默认的 ruby 版本。最终全局的 ruby 版本会是最后一个 <virtualhost> 中给出的 PassengerDefaultRuby

各个 <virtualhost> 应该用 PassengerRuby