Mike Nicholaides
2006-Apr-20 13:37 UTC
[Rails] How do you run a rail app from a subdirectory?
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 -- Posted via http://www.ruby-forum.com/.
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. On 4/20/06, Mike Nicholaides <mike.nicholaides@gmail.com> wrote:> > 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060420/84446dc0/attachment.html