title: Nginx/Passenger runs a Rails app owned by another user. How do i prevent doing "bundle install" for both users?
body: <p><hr/></p>
  
  <h2>Environment</h2>
  
  <p>I used <a href="http://www.modrails.com/install.html" rel="nofollow">passenger-install-nginx-module</a> to install Nginx/Passenger for user <strong>nginxer</strong>.</p>
  
  <p>I uploaded a Rails project and owned it to user <strong>projecter</strong>.</p>
  
  <p>Then i followed the <a href="http://beginrescueend.com/integration/passenger/" rel="nofollow">RVM integration with Passenger</a> manual and created the <code>.rvmrc</code> file, editing the paths so that they point to <strong>projecter</strong>'s .rvm. I also created the <code>config/setup_load_paths.rb</code> file and uncommented the two lines for Bundler 1.x.</p>
  
  <p>I did <code>bunlde install</code> from user <strong>projecter</strong> and successfully performed migrations.</p>
  
  <p><hr/></p>
  
  <h2>Problem</h2>
  
  <p>But the project wouldn't start unless i do <code>bundle install</code> from the <strong>nginxer</strong> user:</p>
  
  <pre><code>no such file to load -- bundler/setup
  
  Backtrace:
  /home/nginxer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
  </code></pre>
  
  <p>I thought that Nginx/Passenger should run the app with the user who owns the project.</p>
  
  <p><hr/></p>
  
  <h2>Some environment info</h2>
  
  <p>Here's an <code>rvm gemset list</code> run by <strong>nginxer</strong> in the project folder:</p>
  
  <pre><code>$ rvm gemset list
  
  gemsets for ruby-1.9.2-p290 (found in /home/redminer/.rvm/gems/ruby-1.9.2-p290)
     global
  =&gt; redmine
  </code></pre>
  
  <p>Here's an <code>rvm info</code> run by <strong>nginxer</strong> in the project folder:</p>
  
  <pre><code>$ rvm info
  
  ruby-1.9.2-p290@redmine:
  
    system:
      uname:       "Linux li308-242 3.0.4-linode37 #1 SMP Mon Sep 12 12:00:58 EDT 2011 i686 GNU/Linux"
      bash:        "/bin/bash =&gt; GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
      zsh:         " =&gt; not installed"
  
    rvm:
      version:      "rvm 1.8.3 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
  
    ruby:
      interpreter:  "ruby"
      version:      "1.9.2p290"
      date:         "2011-07-09"
      platform:     "i686-linux"
      patchlevel:   "2011-07-09 revision 32553"
      full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"
  
    homes:
      gem:          "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine"
      ruby:         "/home/projecter/.rvm/rubies/ruby-1.9.2-p290"
  
    binaries:
      ruby:         "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
      irb:          "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
      gem:          "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
      rake:         "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine/bin/rake"
  
    environment:
      PATH:         "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine/bin:/home/projecter/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/projecter/.rvm/rubies/ruby-1.9.2-p290/bin:/home/projecter/.rvm/bin:/home/projecter/.rvm/gems/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/gems/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/nginxer/.rvm/rubies/ruby-1.9.2-p290/bin:/home/nginxer/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
      GEM_HOME:     "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine"
      GEM_PATH:     "/home/projecter/.rvm/gems/ruby-1.9.2-p290@redmine:/home/projecter/.rvm/gems/ruby-1.9.2-p290@global"
      MY_RUBY_HOME: "/home/projecter/.rvm/rubies/ruby-1.9.2-p290"
      IRBRC:        "/home/projecter/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
      RUBYOPT:      ""
      gemset:       "redmine"
  </code></pre>
  
  <p><hr/></p>
  
  <h2>So the question is…</h2>
  
  <p>Is it normal that i have to do "bundle install" both for <strong>nginxer</strong> and for <strong>projecter</strong>?</p>
  
  <p>If not, how do i make Nginx/Passenger use <strong>projecter</strong>'s gemset?</p>