Forum: Ruby on Rails How do you run a rail app from a subdirectory?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mike Nicholaides (Guest)
on 2006-04-20 17:35
I've looked everywhere and I haven't been able to find a solution.  I'm
running Apache and I have an app under version control (svn).  I want to
be able to have multiple check-outs on one server, and I don't have to
modify httpd.conf every time I do.

Basically, I envisioned that it would work like this:

There's a development server: dev.myserver.com

Each check-out goes in a seperate subdirectory:
dev.myserver.com/r234 -> revision 234 checked out
dev.myserver.com/r235 -> 235th revision

And each checked-out version is an app, so it works like this:
dev.myserver.com/r234/controller/action/id

And the paths from link_to and javascript_include_tag are set right
link_to :controller=>'mycontr'   ->  <a href="/r234/mycont">...</a>

So, it there a way to do this?  I've done a few rails apps, but never
done something like this.

Thanks,
Mike
Brian H. (Guest)
on 2006-04-20 18:28
(Received via mailing list)
You can do this several ways with Apache.  Here's how you do it with
fastcgi
(assuming you have that set up)

Add this to the end of httpd.conf (ensure you've enabled mod_alias!)

Alias /test "c:/rails/test/public"

FastCgiServer c:/rails/test/public/dispatch.fcgi -idle-timeout 120
-initial-env
RAILS_ENV=production -processes 2

<Directory c:/rails/test/public>

  Options ExecCGI FollowSymlinks

  AllowOverride All

</Directory>

And uncomment the RewriteBase line in your .htaccess file for the
corresponding rails app

AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

RewriteEngine On
RewriteBase /test
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to
start properly"

Then just repeat that for each app.

This example is for Windows but just change the paths for Linux and it
works
fine.
This topic is locked and can not be replied to.