[Rails] Re: Multiple application deployments on a single Apache host

Damon Clinkscales damon at vitalbook.com
Thu Dec 2 06:40:11 GMT 2004


>
>> All of the examples I have seen have you set up a single app at a time
>> with its own host.  I looked at the FAQ and didn't see anything.  Can
>> I have a single host in Apache with multiple "/public" directories
>> that run different Rails apps?
>
> Look at the alias directive in apache. You can map in URLs to other
> directories this way.
>
> Next you will need to modify the .htaccess file to deal with the
> different app[1-3...etc] directories and not default to the root level.
> -- 
> Steven Critchfield <critch at basesys.com>

Sorry to be dense here, but I haven't been able to get these rules 
right.

Can you show one example of the corrected mod_rewrite rules for app1?

Here are the default rewrite rules:

# Default rewriting rules. Change extension from .cgi to .fcgi to 
switch to FCGI and to .rb to switch to mod_ruby
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ 
/dispatch.cgi?controller=$1&action=$2&id=$3 [QSA] [L]
RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ 
/dispatch.cgi?controller=$1&action=$2 [QSA] [L]
RewriteRule ^([-_a-zA-Z0-9]+)/$ 
/dispatch.cgi?controller=$1&action=index [QSA] [L]
RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R]

I've tried adding /app1/ to both the left hand and right hand side and 
various other combinations, but none of them seem to work correctly.  
Always a 404 it seems, not even showing up in apache.log or 
production.log.

Hitting the /dispatch.cgi directly works to display the scaffolding 
"list" page, except the Show,Edit,Destroy links aren't right.  It has 
something like http://servername/app1/dispatch.cgi/1 for the Show link. 
    How can I get those "magic rails urls"  in the context of multiple 
apps?

Thanks in advance,
-damon



More information about the Rails mailing list