Apache and Rails via CGI

Before getting into the mod_fcgid method of getting a scalable way to handle a subtantial user load with rails and apache, what about just getting apache and rails to work AT ALL with cgi.

Note that at this point I can run the webrick server via

cd rails ; script/server
I can connect to it via the URL http://server.domain.org:3000/hello/hello.

The above directory rails holds the instant gratification project from the rails book.
I add some recommended lines to the /etc/httpd/conf.d/rails.conf file as follows:

<Directory /www/main/rails/public>
    AllowOverride All
    Options +ExecCGI
    AddHandler cgi-script .cgi
</Directory>

The .htaccess file in rails/public is:

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

ErrorDocument 500 "Application error: Rails application failed to start properly"

I invoke the URL: http://server.domain.org/rails/public/hello/hello and get the 500.html file message after a considerable delay.


Feedback? Questions? Drop me a line!

Ruby on Rails notes / tom@mmto.org