1

I'm using nginx, rvm and passenger to run a web server for a Rails project (i.e., project1). This project has a specific gemset defined for it. I now need to run a second project (i.e., project2) which uses a different set of gems (and has a different gemset defined). How can I accomplish that?

This is what my configuration file for nginx looks like:

http {
  passenger_root /var/www/project1/vendor/cache/ruby/1.9.1/gems/passenger-3.0.
19;
  passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p320@global/ruby;

  # ...

  server {                                                    
    listen        80;                                                     
    server_name   project1.example.com;           

    root              /var/www/project1/public;             
    passenger_enabled on;
    rails_env         production;      

    # ...                       

  }      

    server {                                                    
    listen        80;                                                     
    server_name   project2.example.com;           

    root              /var/www/project2/public;             
    passenger_enabled on;
    rails_env         production;      

    # ...                       

  }              

  # ...
}

project1 works as expected. However, project2 gives me missing gem errors.

Could not find i18n-0.6.4 in any of the sources (Bundler::GemNotFound)

Note how passenger_root points to the passenger gem within project1.

Any pointers on how I can run both projects, would be greatly appreciated. Thank you.

4

1 回答 1

-2

rvm 文档中有一个关于与 Passenger/nginx 集成的部分。解决方案就在那里,需要您添加一个新文件config/setup_load_paths.rb。可以在文档中找到有关该文件的详细信息。

顺便说一句,如果您使用的是 Rails3,那么对于管理特定于应用程序的 gems,bundler 是比 gemsets 更好的选择。

于 2013-04-22T17:19:20.310 回答