On 10/20/05, Larry Kelly <ldk2005 at gmail.com>
wrote:>
> Instant Rails is great! I''ve got the cookbook app running just
fine. But,
> other apps can only be accessed via Webrick. How can I get them to be
> accessible via Apache? Remotely, if possible.
You have to configure SCGI for each rails app. Place your other rails
applications in the "rails_apps" subdirectory and do "Rails
Applications >>
Manage Rails Application...", select the checkbox on your new application
and then closk on "Configure SCGI Settings..."
This will pop up some instructions on how to configure the SCGI settings for
your new app.
The default method for running multiple rails apps is to use apache''s
VirtualHost facility. This means that each Rails app needs its own domain
name. This can be faked from your local machine (the popup instructions tell
you how to do this), but if you want to access it from other machines you
need real domain names.
It''s also possible to sun each Rails app in a subdirectory off of a
single
domain. The setup for this is more complicated. Eventually there will be a
instructions for this on the Instant Rails web site, but for now I copied
below a recent posting to the Rails ML below that tells how to do this.
Curt
===============================================
Paul Wright to rails
Hi Brian,
This is what I did to get Rails to run in a subdirectory under Apache
and SCGI on linux:
httpd.conf:
SCGIMount /rails/app 127.0.0.1:9999 <http://127.0.0.1:9999/>
<Directory /var/www/rails/>
AllowOverride All
</Directory>
So the mount point is a virtual subdirectory inside the rails public
directory
public/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /rails/app/$1 [QSA,L]
And then in routes.rb double up each route thus:
ActionController::Routing::Routes.draw do |map|
base_dir = "app/"
# Add your own custom routes here.
# The priority is based upon order of creation: first created ->
highest priority.
# Here''s a sample route:
# map.connect ''products/:id'', :controller =>
''catalog'', :action => ''view''
# Keep in mind you can assign values other than :controller and :action
# You can have the root of your site routed by hooking up ''''
# -- just remember to delete public/index.html.
map.connect '''', :controller => "admin"
map.connect base_dir + '''', :controller => "admin"
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named ''wsdl''
map.connect '':controller/service.wsdl'', :action =>
''wsdl''
map.connect base_dir + '':controller/service.wsdl'', :action
=> ''wsdl''
# Install the default route as the lowest priority.
map.connect '':controller/:action/:id''
map.connect base_dir + '':controller/:action/:id''
end
So the pattern here is the same as FCGI deployment, get the webserver
to check for the existance of a static file that matches the request
first, if not then rewrite the request to use the SCGI mount point
instead. Other than that I didn''t need to set
ActionController::Base.asset_host (although I spent a while trying to
get it working with just that). Just ensure that the prefix route is
a lower priority than the one you want to use publicly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/instantrails-users/attachments/20051020/fb691c24/attachment.htm