# Scgi apache routes help needed

**URL:** <https://www.ruby-forum.com/t/scgi-apache-routes-help-needed/51355>\
**Category:** Rails\
**Created:** [December 30, 2005, 2:14am UTC](https://www.ruby-forum.com/t/scgi-apache-routes-help-needed/51355 "2005-12-30T02:14:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aseldo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e95f7d/32.png) [@aseldo](https://www.ruby-forum.com/u/aseldo)\
**Post date:** [December 30, 2005, 2:14am UTC](https://www.ruby-forum.com/t/scgi-apache-routes-help-needed/51355/1 "2005-12-30T02:14:32Z")

</div>

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](http://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](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

---

<div class="post-metadata">

**Author:** ![aseldo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e95f7d/32.png) [@aseldo](https://www.ruby-forum.com/u/aseldo)\
**Post date:** [January 20, 2006, 11:00am UTC](https://www.ruby-forum.com/t/scgi-apache-routes-help-needed/51355/2 "2006-01-20T11:00:57Z")

</div>

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

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](http://www.knowdennis.de/show/projekte __%26__ arbeiten/dokumente/rails __on__ scgi)

---

<div class="post-metadata">

**Author:** ![aseldo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e95f7d/32.png) [@aseldo](https://www.ruby-forum.com/u/aseldo)\
**Post date:** [December 30, 2005, 5:20pm UTC](https://www.ruby-forum.com/t/scgi-apache-routes-help-needed/51355/3 "2005-12-30T17:20:41Z")

</div>

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