views:

197

answers:

2

Hi,

i first installed mod_ruby on my debian and afterwards ( after figuring out that it was too slow ) i wanted to chagne to passenger for my apache

Now i've got the problem, that the passenger is successfully loaded by the apache, but is not used, even though i configured everything correctly, like:

<VirtualHost *>
        ServerAdmin webmaster@localhost
        ServerName xyz
        DocumentRoot /var/www/vhosts/default/htdocs/
        RailsBaseURI /rails
</VirtualHost>

Instad of the the passenger the cgi - module is used for displaying rails-apps... ( if i unload the cgi.conf and cgi-load from the "sites-enabled" folder, it's not working anymore... on the other hand it still works if i unload the passenger.load and passenger.conf files... )

So, how can i force the apache to use the passenger to display rails sites?

+1  A: 

Assuming you have passenger installed and configured correctly with Apache ... Your DocumentRoot needs to point at the public directory of your rails app. Here's a working VirtualHost directive:

<VirtualHost *:80>
  ServerName myapp.local
  DocumentRoot "/path/to/myapp/public"
  RailsEnv development
  <directory "/path/to/myapp/public">
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>


Beforehand, also make sure that named virtual hosts are turned on:

NameVirtualHost *:80

And also that you actually have the passenger model configured correctly. For example:

LoadModule passenger_module /path/to/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /path/to/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /path/to/bin/ruby
Ryan McGeary
i have other apps installed, so i can't chage the document root to the public-folder of the rails-app.. thats why i linked the "/rails" to my "rails-apps" folder... actually the requests and paths of the rails application shouldn't be the problem, as they are working ( well, not with passenger, but with cgi )
David
Understood, see my other answer attempt.
Ryan McGeary
A: 

Did you reconfigure the relative_url_root in your rails application? For example, in config/environment.rb:

config.action_controller.relative_url_root = "/rails"
Ryan McGeary
with this i get a: undefined method `relative_url_root=' for ActionController::Base:Class (NoMethodError)
David
What version of rails?
Ryan McGeary