Scgi apache routes help needed


#1

I’m trying to get an application running in a sub directory of a site
using
apache and scgi. The application runs fine with webrick.

I have a site. Let’s call it “mysite.org”. There is a variety of content
on
that site.

I would like to add a rails application to that site. Let’s call the
application “myapp”.

So we will have urls of the form http://mysite.org/myapp.

I’m trying to use scgi with the existing apache installation.

What is the current required changes to

  1. httpd.conf
  2. myapp/public/.htaccess
  3. myapp/config/routes.rb
  4. any others?

I’m attracted to the scgi concept because of the “easy to configure”
advertisement, but so far it hasn’t been easy to configure. To be fair,
scgi
is probably easy to configure - it may be the other things in the system
that are complicating things like apache and rails. For that matter
hints on
debugging would be useful.

Many thanks for any and all help.

-kelly dwight felkins

Here is what I currently have:

.htaccess

:

Example:

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

RewriteEngine On

If your Rails application is accessed via an Alias directive,

then you MUST also set the RewriteBase in this htaccess file.

Example:

Alias /myapp /var/www/myapp/public

RewriteBase /myapp

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /myapp/$1 [QSA,L]

#RewriteRule ^$ index.html [QSA]
:

httpd.conf

Alias /myapp /var/www/myapp/public
<Directory /var/www/myapp/public>
Options ExecCGI FollowSymlinks
AllowOverride All

Automatically added by the post-installation script

as part of the transition to a config directory layout

similar to apache2, and that will help users to migrate

from apache to apache2 or revert back easily

Include /etc/apache/conf.d

SCGIMount /myapp 127.0.0.1:9999
<Directory /var/www/myapp/>
AllowOverride All

routes.rb

– just remember to delete public/index.html.

map.connect ‘’, :controller => “welcome”

Allow downloading Web Service WSDL as a file with an extension

instead of a file named ‘wsdl’

map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’

Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id’
end


#2

Kelly Dwight F. wrote:

  1. httpd.conf
  • setting up a new directory section
  • define the SCGI Mountpoint in it
  • additionally add some alias commands to it, so you’ll be able to
    access the public directory of your rails application
  1. myapp/public/.htaccess
    There’s nothing to change here, since SCGI doesn’t access the dispatcher
    by apache.
  1. myapp/config/routes.rb
  • when you application is designed to be located at the servers root,
    then you probably have to add the directory prefix to you routes like
    this

    PREFIX = ‘/myapp/’
    map.connect PREFIX + ‘:controller/:action/:id’

You also should have a look to my website. I’ve written a how-to(1)
about apache + ror + mod_scgi (currently german only, sorry). Perhabs
the listings may help you.

Best regards,
Dennis Wilson

(1)
http://www.knowdennis.de/show/projekte__%26__arbeiten/dokumente/rails__on__scgi


#3

I don’t think this made it to the list the first time, so I am
resending.