Rails Passenger problem with Apache2

Andre Schweighofer picture Andre Schweighofer · Jun 11, 2011 · Viewed 23.4k times · Source

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!

Answer

superluminary picture superluminary · Sep 19, 2012

The reason mod_passenger.so does not exist is because you haven't installed the Apache module. Execute:

passenger-install-apache2-module

This will create the mod_passenger.so file inside your gem directory, and give you three lines to copy into your apache2.conf file.

The passenger module is installed in your current gemset so you shouldn't get any conflicts between projects. You can use any compatible version of Ruby, and any gemset you like, via RVM, and possibly also RBENV. This makes for a nice easy upgrade path from one version of Ruby to the next.