Damon Clinkscales
2004-Dec-01 19:03 UTC
Multiple application deployments on a single Apache host
Hi Everyone, I am setting up Rails for a team of developers to be able to set up their own apps easily to play with Rails. Ideally this would look something like: http://servername/app1/list http://servername/app2/edit/0 http://servername/app3/show/1 etc... all on the same server, on port 80 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? What I''ve done in the meantime is gone with a new port for each app, adding this section to httpd.conf for new apps Listen 3000 < VirtualHost theipaddresshere:3000> DocumentRoot /Users/admin/rails/bin/App1/public ServerName servername.domain.com <Directory "/Users/bob/rails/bin/App1/public/" > Options ExecCGI FollowSymLinks AddHandler cgi-script .cgi AllowOverride all Order allow,deny Allow from all </Directory> </VirtualHost> Obviously this isn''t ideal, but it works fine for testing. I''m running on Mac OS X Panther Server. Thanks for any ideas! Damon _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Critchfield
2004-Dec-01 19:12 UTC
Re: Multiple application deployments on a single Apache host
On Wed, 2004-12-01 at 11:03 -0800, Damon Clinkscales wrote:> > > ______________________________________________________________________ > > Hi Everyone, > > I am setting up Rails for a team of developers to be able to set up > their own apps easily to play with Rails. Ideally this would look > something like: > > http://servername/app1/list > http://servername/app2/edit/0 > http://servername/app3/show/1 > etc... > > all on the same server, on port 80fine> 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-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org>
Damon Clinkscales
2004-Dec-02 06:40 UTC
Re: Multiple application deployments on a single Apache host
> >> 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-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org>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
Steven Critchfield
2004-Dec-02 07:08 UTC
Re: Re: Multiple application deployments on a single Apache host
On Wed, 2004-12-01 at 22:40 -0800, Damon Clinkscales wrote:> > > >> 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-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org> > > Sorry to be dense here, but I haven''t been able to get these rules > right.Check this thread out. http://one.textdrive.com/pipermail/rails/2004-November/000190.html -- Steven Critchfield <critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org>
Han Holl
2004-Dec-02 10:03 UTC
Re: Multiple application deployments on a single Apache host
On Wednesday 01 December 2004 20:03, Damon Clinkscales wrote:> Hi Everyone, > > I am setting up Rails for a team of developers to be able to set up > their own apps easily to play with Rails. Ideally this would look > something like: > > http://servername/app1/list > http://servername/app2/edit/0 > http://servername/app3/show/1 > etc... >Hello, I posted a page with a apache configuration to do that on the rails wiki, but unfortunately it got lost. I''m attaching it now, because the lines are a bit uncomfortably long for email. With this method you can do what you want just fine, and avoid per directory rewriting which is a hack, really. Of course you have to take care with relative URLs in the application, but resource sharing is much easier. Cheers, Han Holl _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails