Using Mongrel,and Apache Alias


#1

I’m trying to bring my rail app into production on a server I have,
but I keep running into problems getting Apache and Mongrel to play
nicely.

Short Summary:

Mongrel is up and running fine (port 8000) and I can connect to it and
browse my app without issue. The problem is trying to proxy it
through Apache. My current apache server is used to serve several
other no rails applications and I have no way of changing that. I am
trying to alias to the rails app, and let mongrel handle it in the
background. Whenever I browse to my rails app through my apache, I
get page not found errors, for everything. I looked in my production
log, and apparently it is trying to send my alias director (/tora) to
the router, instead of using it as the document root. Below is the
error, and the apache.conf settings I am using for my alias. Any help
would be greatly appreciated.

-----------------------ERROR----------------------------

Processing ApplicationController#index (for 160.129.18.96 at
2007-06-29 17:07:09) [GET]
Session ID: 35cdb51b7a9eb766702bc4ee9be34945
Parameters: {}

ActionController::RoutingError (no route found to match “/tora/” with
{:method=>:get}):
/vendor/rails/actionpack/lib/action_controller/routing.rb:1292:in
recognize_path' /vendor/rails/actionpack/lib/action_controller/routing.rb:1282:inrecognize’
/vendor/rails/railties/lib/dispatcher.rb:40:in dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 78:inprocess’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:
76:in synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 76:inprocess’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:ineach’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:innew’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:ininitialize’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
configurator.rb:271:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:ineach’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
configurator.rb:270:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:
211:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 /usr/bin/mongrel_rails:16:inload’
/usr/bin/mongrel_rails:16

-----------------------.CONF----------------------------

Alias /tora “/var/www/tora/public”
<Directory “/var/www/tora/public”>
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all

RewriteEngine On

RewriteCond %/var/www/tora/public/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

RewriteRule ^/$ /index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %/var/www/tora/public/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001