As a note on http://wiki.rubyonrails.org/rails/pages/SCGI+Rails+Runner+with+Apache+2+on+Linux
Note: you may not need to edit the .htaccess file at all. Don’t be afraid if you do it and find an error messsage in apache/logs/error that the rewrite engine on directive is not recognized. This means that mod_rewrite is not installed but it may not be necessary for SCGI anyway. Apparently not necessary these days.
*THOUGHT*:
(I’m not the guy above but I have got SCGI running in a subdirectory on Apache 2)
I recently upgraded to Rails 1.0.0 and things stopped working for me even though everything had previously been going fine. Turns out that my scgi mount point looked different to what rails was expecting. Lesson learnt: be sure that the mount point ends in dispatch.(cgi|fcgi|rb). (That’s _dispatch.cgi_, _dispatch.fcgi_ or _dispatch.rb_ – not dispatch.scgi which I used thinking myself clever.)
Thus my httpd.conf looks like:
With my .htaccess looking like:
apache error_log:
[Sun Apr 16 15:37:59 2006] [error] [client 218.0.175.212] Premature end of script headers:
[Sun Apr 16 15:37:59 2006] [error] [client 218.0.175.212] (500)未知的错误 500: scgi: \xce\xb4\xd6\xaa\xb5\xc4\xb4\xed\xce\xf3 500: error reading response headers
and scgi server seems died
an old thought — see the main page I think it works now
I haven’t figured out how to work this properly and it’s not quite well documented/standardized yet.
Tickets #”3070″:http://dev.rubyonrails.org/ticket/3070 and changeset #”3237″:http://dev.rubyonrails.org/changeset/3237 both deal with SCGI installations. IMO, this situation is still a bit hosed under Apache due to the way that the way mod_rewrite works.
What we want is for the relative_url_root to be the same as the base of our Alias (i.e., both are /rails/). Currently, this requires that our SCRIPT_NAME is under the same general location as the static content, +- a dispatch\.(cgi|fcgi|rb). You want to all RoR requests to /rails/dispatch.cgi, for example, since that gives the relative_url_root of /rails/. Since you also need the static files from the filesystem, you also need /rails/ to point to /filesystem/directory/rails_root/public/. The Alias, however, has precedence over the SCGIMount directive, and /rails/dispatch.cgi is the source of a recursive mod_rewrite loop.
Again, I might be missing something here which might be better suited for an off-site discussion. Till it’s resolved/more accurately documented, consider this a placeholder.
*UPDATE*:
Those tickets mentioned above appear resolved, so it may work now.
I’m not sure about that stuff…hard to understand