ruby-on-railsapache2passengerubuntu-10.10mod-rails

Rails Passenger problem with Apache2


I'm trying to setup a ruby on rails server on ubuntu10.10 with apache2 and mod_rails (Phusion Passenger).

I already installed ruby 1.9.2-p0 and rails 3.0.8 and installed Passenger with the passenger-install-apache2-module and the passenger gem (v3.0.7).

It then tells me to add 3 lines to my Apache config file. So I added these lines to '/etc/apache2/apache2.conf':

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby

And I edited my '/etc/apache2/httpd.conf' and added:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName 192.168.0.2
DocumentRoot /var/www/webop/public

<Directory /var/www/webop/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>

I also found out that the file mod_passenger.so in /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/ actually does not exist, its name is mod_passenger.c. But I don't get any errors from that.

The server should only be accessible through a LAN. When I access the server I see all the files and directories in the public folder of my app but the app itself does not get started.

When I restart apache it tells me that mod_rails is already loaded so I guess that passenger is running but I can't figure out why it doesn't start my app!

Thanks in advance!


Solution

  • I finally figured out what the problem was: I messed up my ruby installation.

    In /usr/local/ I had ruby1.9.2-p0 installed (which was the version I wanted to use) but in /usr/ i had ruby1.8.7 installed.

    Passenger was confused which ruby version to use so I changed the LoadModule, PassengerRoot and PassengerRuby paths within apache2/mods-enabled/passenger.load and .config to the correct paths and it finally worked! Both files were created automatically which also caused the problem of a redefinition: On apache startup there was a warning 'mod_passenger already loaded'. So I removed

    LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/lib/gems/1.9.1/gems/passenger-3.0.7
    PassengerRuby /usr/local/bin/ruby
    

    from the apache config and the warning disappeared!

    Probably this will help someone else some day!