title: Trouble with Apache2 + Passenger + Redmine
body: <p>I'm having trouble installing Redmine.  It seems to run just fine under webrick like this:</p>
  
  <pre><code>redmine@machine:~$ /usr/bin/ruby1.8 script/rails server webrick -e production
  </code></pre>
  
  <p>Note that this is when I'm logged in as user 'redmine'.</p>
  
  <p>I installed Passenger (v3.0.17) against my existing Apache2 installation and use a /etc/apache2/mods-enabled/passenger.conf like this:</p>
  
  <pre><code>LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
  PassengerDefaultUser www-data
  PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17
  PassengerRuby /usr/bin/ruby1.8
  </code></pre>
  
  <p>My virtual host conf is very simple too:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin webmaster@machine.com
      ServerName redmine.machine.com
  
      RailsEnv production
  
      DocumentRoot /home/redmine/redmine-2.1/public
  
      &lt;Directory /home/redmine/redmine-2.1/public&gt;
          # This relaxes Apache security settings.
          AllowOverride all
          # MultiViews must be turned off.
          Options -MultiViews
      &lt;/Directory&gt;
  
  
      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn
      ErrorLog /var/log/apache2/redmine.error.log
      CustomLog /var/log/apache2/redmine.access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When I run this, I get an error "no such file to load -- bundler".  However, notice:</p>
  
  <pre><code>redmine@machine:~$ gem list
  
  *** LOCAL GEMS ***
  
  actionmailer (3.2.8)
  actionpack (3.2.8)
  activemodel (3.2.8)
  activerecord (3.2.8)
  activerecord-mysql2-adapter (0.0.3)
  activeresource (3.2.8)
  activesupport (3.2.8)
  arel (3.0.2)
  builder (3.0.0)
  bundler (1.2.1)
  coderay (1.0.8)
  daemon_controller (1.0.0)
  erubis (2.7.0)
  fastercsv (1.5.5)
  fastthread (1.0.7)
  hike (1.2.1)
  i18n (0.6.1)
  journey (1.0.4)
  jquery-rails (2.0.3)
  json (1.7.5)
  mail (2.4.4)
  mime-types (1.19)
  multi_json (1.3.6)
  mysql (2.8.1)
  mysql2 (0.3.11)
  net-ldap (0.3.1)
  passenger (3.0.17)
  pg (0.14.1)
  polyglot (0.3.3)
  rack (1.4.1)
  rack-cache (1.2)
  rack-openid (1.3.1)
  rack-ssl (1.3.2)
  rack-test (0.6.2)
  rails (3.2.8)
  railties (3.2.8)
  rake (0.9.2.2)
  rdoc (3.12)
  rmagick (2.13.1)
  ruby-openid (2.1.8)
  rvm (1.11.3.5)
  sprockets (2.1.3)
  sqlite3 (1.3.6)
  thor (0.16.0)
  tilt (1.3.3)
  treetop (1.4.11)
  tzinfo (0.3.33)
  </code></pre>
  
  <p>All files in <code>/home/redmine/redmine-2.1</code> are owned by <code>redmine:redmine</code>.  All directories are <code>0755</code> and all files are <code>0644</code>.</p>
  
  <p>Now, the interesting thing I have noticed when I show processes:</p>
  
  <pre><code>redmine@machine:~$ ps -ef | grep "Passenger"
  root     21764 21759  0 10:49 ?        00:00:00 PassengerWatchdog
  root     21773 21764  0 10:49 ?        00:00:00 PassengerHelperAgent
  root     21775 21773  0 10:49 ?        00:00:00 Passenger spawn server                                                                                                                                           
  nobody   21778 21764  0 10:49 ?        00:00:00 PassengerLoggingAgent
  </code></pre>
  
  <p>I'm certainly no expert in Ruby/Rails/Passenger/Redmine, but I suspect that the fact that Passenger is running as <code>nobody</code> instead of <code>redmine</code> may be the problem.  According to the docs here: <a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching" rel="nofollow">http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching</a>, Passenger is supposed to switch users to the user who owns /config/environment.ru, so long as that user can read/write logs and is not <code>root</code>, correct?  As you can see from the above, that file (the whole app, in fact) is owned by <code>redmine</code>, including the logs which are <code>rwx</code> for the owner and <code>redmine</code> ≠ <code>root</code> so, I believe that I've passed the requirements for Passenger to switch to run as <code>redmine</code>.</p>
  
  <p><strong>Three direct questions:</strong></p>
  
  <ol>
  <li>Is this the cause of my inability to run Redmine under Passenger? and**</li>
  <li>Why is Passenger still running as <code>nobody</code>?**</li>
  <li><p>In my attempt to fix this, I tried adding the line:</p>
  
  <p>PassengerDefaultUser www-data</p></li>
  </ol>
  
  <p>into my /etc/apache2/mods-enabled/passenger.conf (as shown above), but it appears to not take affect.  The results of everything is identical with and without that line.  I wouldn't have expected it to fix the problem, but I did expect it to show up as the user that Passenger runs as when I list processes.  It did not.</p>
  
  <p>Other possibly relevant info:</p>
  
  <pre><code>redmine@machine:~$ uname -a
  Linux machine.****.com 2.6.18-028stab092.1 #1 SMP Wed Jul 20 19:47:12 MSD 2011 x86_64 GNU/Linux
  Ubuntu 10.04.4 LTS
  
  redmine@machine:~$ /usr/bin/ruby1.8 --version
  ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
  </code></pre>