views:

239

answers:

2

i'm trying to get working an old rails 2.1 application configured with mongrel cluster.

passenger is correctly installed on my system (apache) with this configuration

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby1.8

RailsSpawnMethod smart
PassengerMaxPoolSize 1
PassengerMaxInstancesPerApp 1
PassengerPoolIdleTime 2000
RailsFrameworkSpawnerIdleTime 0
RailsAppSpawnerIdleTime 0

my project is located on

/var/sites/site

this is the apache configuration

<Virtualhost tagi:80>
  ServerName site.com
  ServerAlias www.site.com

  DocumentRoot /var/sites/site/current/

  #PassengerHighPerformance on
  ##PassengerMaxRequests 5000
  PassengerStatThrottleRate 5

  <Directory />
    AllowOverride AuthConfig
  </Directory>

  ErrorLog /var/log/apache2/site-error.log
  CustomLog /var/log/apache2/site-access.log combined
  ServerSignature Off
</Virtualhost>

With mongrel app boot correctly and work perfectly. But with apache2 + passanger, the boot doesn't work and i get default directory listing from apache.

this is the permissions of configs files

-rw-r----- 1 git web 2.7K 2009-11-11 11:34 boot.rb
-rw-r----- 1 git web  600 2009-11-11 13:51 database.yml
-rw-r----- 1 git web 1.7K 2009-11-11 11:34 deploy.rb
-rw-r----- 1 git web 3.9K 2009-11-11 14:04 environment.rb
drwxr-x--- 2 git web 4.0K 2009-11-11 11:34 environments
-rw-r----- 1 git web  754 2009-11-11 11:34 gmaps_api_key.yml
drwxr-x--- 2 git web 4.0K 2009-11-11 11:34 initializers
-rw-r----- 1 git web 1.8K 2009-11-11 11:34 routes.rb

i don't have any idea. apache logs are clear.

on my server i have already 5 application running with the same configuration.

any suggestion?

A: 

Point DocumentRoot at your apps public directory. I'm not sure what /var/sites/site/current/ is, but that's probably not what you want.

Also you can try to explain to passenger more explicitly where you want it to mount the rails app by putting RailsBaseURI / in your vhost.

Give that a try and we can go from there.

thenduks
thnx, /current is right (deployed with capistrano) but i forgot /public on my path/var/sites/site/current/public was the right path.i need a pause :)
Davide
A: 

Struggled a loooong time with this one. The way I found to get this to work, especially when running multiple instances of Passenger with different environments (production, debug, test, etc) is to do something like this:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName server.com
        ServerAlias www.server.com
        DocumentRoot /var/sites/current/public
        RailsBaseURI /current
        RailsEnv production
</VirtualHost>

<VirtualHost *:80>
        ServerName dev.server.com
        DocumentRoot /var/sites/dev-version/public
        RailsBaseURI /dev-version
        RailsEnv development
</VirtualHost>

and then setup sym links from /var/sites/ to point to

lrwxrwxrwx 1 root root 13 Aug 24 17:41 current -> /code/site5
lrwxrwxrwx 1 root root 19 Aug 24 17:41 test-version -> /code/site-test
lrwxrwxrwx 1 root root 19 Sep 21 09:41 dev-version -> /code/development

This way Passenger can tell the difference between the sites as all of their DocumentRoot paths are different. You may not have this problem if you are pointing to the code directories directly rather than via symlinks.

Lukas