VPS Apache配置 - 无效的命令'PassengerDefaultRuby“,并称最新的宝石乘客后, [英] VPS apache config - Invalid command 'PassengerDefaultRuby' after adding latest passenger gem
问题描述
曾经有过在我的VPS红宝石这个列表:
used to have this list of rubies in my vps:
ruby-1.9.2-p320 [ i686 ]
=* ruby-1.9.3-p194 [ i686 ]
ruby-1.9.3-p374 [ i686 ]
ruby-1.9.3-p392 [ i686 ]
今天我安装这个新的应用VPS上红宝石2.0
,所以我加了2.0到 RVM
:
today I installed a new app on this vps on ruby 2.0
, so I added 2.0 to rvm
:
ruby-1.9.2-p320 [ i686 ]
ruby-1.9.3-p194 [ i686 ]
ruby-1.9.3-p374 [ i686 ]
ruby-1.9.3-p392 [ i686 ]
=* ruby-2.0.0-p247 [ i686 ]
安装乘客
和乘客的Apache模块
,指示说要添加这些行:
installed passenger
and passenger-apache-module
, instructions says to add these lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby
到 /etc/apache2/apache2.conf中
键,重启apache,重启后,我得到了这个错误
to /etc/apache2/apache2.conf
and restart apache, after restart I got this error:
Syntax error on line 242 of /etc/apache2/apache2.conf:
Invalid command 'PassengerDefaultRuby', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
和一个更多的问题后,当我打开我的应用程序在 http://nccm.md 我:
and one more problem, when I open my app at http://nccm.md I got:
Could not find rake-10.1.0 in any of the sources (Bundler::GemNotFound)
从宝石列表
命令,我可以看到这块宝石被安装在红宝石2.0环境,但应用程序查找它在 USR /本地/ RVM /gems/ruby-1.9.3-p194@global
。这是为什么?感谢您的任何帮助。
from gem list
command I can see this gem is installed in ruby 2.0 environment, but the app looks for it in usr/local/rvm/gems/ruby-1.9.3-p194@global
. Why is that? Thank you for any help.
推荐答案
明白了!
您需要具有root级别分配一个默认红宝石,其他的人,你会设置启用的站点 -
配置文件。例如,在我的 apache2.conf
文件:
you need to have a default ruby assigned at root level, the other ones you'll set in sites-enabled
configuration files. For example, in my apache2.conf
file:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.19
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby
然后的/ etc / apache2的/启用站点-/ mysite的
的火起来的应用程序应该在红宝石1.9.3 <工作/ code>我会添加
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
:
then in /etc/apache2/sites-enabled/mysite
that fires up the app that should work in ruby-1.9.3
I'll add PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
:
<VirtualHost xxx.xx.xx.xx:80>
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
ServerName mysite.md
DocumentRoot /home/apps/myapp/public
<Directory /home/apps/myapp>
AllowOverride None
Options -MultiViews
</Directory>
</VirtualHost>
有关与红宝石2.0
无需添加 PassengerRuby
选项,红宝石2.0
是默认的了。
for the app that works with ruby-2.0
no need to add PassengerRuby
option as ruby-2.0
is the default one now.
此外,如果你有apache2.config文件中加载其他乘客RVM模块,就像在我的情况我有:
Also if you have other rvm passenger modules loaded in apache2.config file, like in my case I had:
# LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
# PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.18
# PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
你需要将其删除或评论他们像我一样,因为你会加载红宝石版本的/ etc / apache2的/网站启用/ mysite的
配置文件中。
注意!
这只会在乘客> 4.0.0工作。我已经测试这对
乘客3.0.8,它不工作。需要注意的是PassengerDefaultRuby
客运4.0.0版推出时,看到
modrails.com/documentation/...。
This will only work on passenger > 4.0.0. I have tested this on passenger-3.0.8 and it does not work. Note that PassengerDefaultRuby was introduced in passenger version 4.0.0, see modrails.com/documentation/….
这篇关于VPS Apache配置 - 无效的命令'PassengerDefaultRuby“,并称最新的宝石乘客后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!