如何使用 rvm 和独特的 gem 集从 apache 加载乘客
我有两个网站在同一台服务器上运行。两者都使用乘客和房车。每个网站都有一个独特的 rvm gemset。我遇到的问题是如何配置乘客在 apache 中启动。
这是我的 apache 乘客配置:
ubuntu@www01:/etc/apache2/mods-enabled$ ls passenger.*
passenger.conf passenger.load
ubuntu@www01:/etc/apache2/mods-enabled$ cat passenger.conf
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.8.7-p334@snowcrash/gems/passenger-3.0.2
PassengerRuby /home/ubuntu/.rvm/wrappers/ruby-1.8.7-p334@snowcrash/ruby
ubuntu@www01:/etc/apache2/mods-enabled$ cat passenger.load
LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-1.8.7-p334@snowcrash/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
您可以从上面看到,我已将 apache 配置为从 ruby-1.8.7-p334@snowcrash rvm gem 集加载乘客模块/配置。我的问题在于为我的其他网站 ruby-1.8.7-p334@pixel-pets 设置了额外的 gem。我考虑过在全局宝石集中安装乘客,但我认为当它尝试加载我的项目特定宝石集特有的宝石时,它会遇到问题。
以下是我为每个项目安装的 gem:
ubuntu@www01:/etc/apache2/mods-enabled$ rvm use 1.8.7@snowcrash
Using /home/ubuntu/.rvm/gems/ruby-1.8.7-p334 with gemset snowcrash
ubuntu@www01:/etc/apache2/mods-enabled$ gem list -l
*** LOCAL GEMS ***
actionmailer (2.3.11)
actionpack (2.3.11)
activerecord (2.3.11)
activeresource (2.3.11)
activesupport (2.3.11)
daemon_controller (0.2.6)
fastthread (1.0.7)
file-tail (1.0.5)
haml (3.0.25)
hpricot (0.8.4)
mysql (2.8.1)
passenger (3.0.2)
rack (1.1.2)
rails (2.3.11)
rake (0.8.7)
spruz (0.2.5)
ubuntu@www01:/etc/apache2/mods-enabled$ rvm use 1.8.7@pixel-pets
Using /home/ubuntu/.rvm/gems/ruby-1.8.7-p334 with gemset pixel-pets
ubuntu@www01:/etc/apache2/mods-enabled$ gem list -l
*** LOCAL GEMS ***
actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
backports (1.18.2)
border_patrol (0.1.0)
bson (1.3.0, 1.1.1)
bson_ext (1.3.0, 1.1.1)
faker (0.3.1)
jnunemaker-validatable (1.8.4)
mongo (1.1.1)
mongo_mapper (0.8.6)
nokogiri (1.4.3.1)
plucky (0.3.7)
rack (1.1.2)
rails (2.3.8)
rake (0.8.7)
will_paginate (2.3.12)
I have two websites running on the same server. Both use passenger and rvm. Each website has a unique rvm gemset. The problem I'm running into is how I would configure passenger to start up in apache.
Here's my apache passenger configurations:
ubuntu@www01:/etc/apache2/mods-enabled$ ls passenger.*
passenger.conf passenger.load
ubuntu@www01:/etc/apache2/mods-enabled$ cat passenger.conf
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.8.7-p334@snowcrash/gems/passenger-3.0.2
PassengerRuby /home/ubuntu/.rvm/wrappers/ruby-1.8.7-p334@snowcrash/ruby
ubuntu@www01:/etc/apache2/mods-enabled$ cat passenger.load
LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-1.8.7-p334@snowcrash/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
You can see from above, that I've configured apache to load the passenger module/configurations from the ruby-1.8.7-p334@snowcrash rvm gem set. My problem lies in having an additional gem set for my other website, ruby-1.8.7-p334@pixel-pets. I've thought about installed passenger in the global gem set, but I think it would see issues when it tries loading gems unique to my project specific gem sets.
Here are my installed gems for each project:
ubuntu@www01:/etc/apache2/mods-enabled$ rvm use 1.8.7@snowcrash
Using /home/ubuntu/.rvm/gems/ruby-1.8.7-p334 with gemset snowcrash
ubuntu@www01:/etc/apache2/mods-enabled$ gem list -l
*** LOCAL GEMS ***
actionmailer (2.3.11)
actionpack (2.3.11)
activerecord (2.3.11)
activeresource (2.3.11)
activesupport (2.3.11)
daemon_controller (0.2.6)
fastthread (1.0.7)
file-tail (1.0.5)
haml (3.0.25)
hpricot (0.8.4)
mysql (2.8.1)
passenger (3.0.2)
rack (1.1.2)
rails (2.3.11)
rake (0.8.7)
spruz (0.2.5)
ubuntu@www01:/etc/apache2/mods-enabled$ rvm use 1.8.7@pixel-pets
Using /home/ubuntu/.rvm/gems/ruby-1.8.7-p334 with gemset pixel-pets
ubuntu@www01:/etc/apache2/mods-enabled$ gem list -l
*** LOCAL GEMS ***
actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
backports (1.18.2)
border_patrol (0.1.0)
bson (1.3.0, 1.1.1)
bson_ext (1.3.0, 1.1.1)
faker (0.3.1)
jnunemaker-validatable (1.8.4)
mongo (1.1.1)
mongo_mapper (0.8.6)
nokogiri (1.4.3.1)
plucky (0.3.7)
rack (1.1.2)
rails (2.3.8)
rake (0.8.7)
will_paginate (2.3.12)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自:https://rvm.beginrescueend.com/integration/passenger/
在您的
.rvmrc
do:或者只是创建它:
然后在每个rails项目中,添加一个新文件
config/setup_load_paths.rb
并添加当然你应该替换
/Users/sutto/.rvm
为您的 rvm 路径,ruby-1.8.7-p334@snowcrash
为正确的 gemset。From: https://rvm.beginrescueend.com/integration/passenger/
In your
.rvmrc
do:Or just create it with:
Then in each rails project, add a new file
config/setup_load_paths.rb
and addOf course you should replace
/Users/sutto/.rvm
by your rvm path, andruby-1.8.7-p334@snowcrash
by the correct gemset.