Apache and CGI

I got myself into a world of trouble trying to set up Apache with rails and mod_fcgid, so I thought it might be smart to take some steps back and sneak up on things.

I decide to set up a directory cgi to hold a simple perl CGI script as follows (named mycgi.cgi):

#!/usr/bin/perl

print "Content-type: text/html\n";
print "\n";
print "<h2>";
print "Hello World";
print "</h2>\n";

I find I must use chmod a+x mycgi.cgi to make it executable, and I put the following lines into my httpd.conf (actually into conf.d/rails.conf).

<Directory /www/main/cgi>
    Options +ExecCGI
    AddHandler cgi-script .cgi
</Directory>

This seems to work, and I am ready to move on to more complicated things, namely setting up rails to work via this plain old CGI mechanism.


Feedback? Questions? Drop me a line!

Ruby on Rails notes / [email protected]