Forum: Ruby on Rails scgi apache routes help needed

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.
Kelly Dwight F. (Guest)
on 2005-12-30 03:14
(Received via mailing list)
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
</Directory>

# 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
</Directory>
---------------------

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
Kelly Dwight F. (Guest)
on 2005-12-30 18:20
(Received via mailing list)
I don't think this made it to the list the first time, so I am
resending.
Dennis Wilson (Guest)
on 2006-01-20 12:00
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

>    2. myapp/public/.htaccess
There's nothing to change here, since SCGI doesn't access the dispatcher
by apache.

>    3. 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__arbei...
This topic is locked and can not be replied to.