Wednesday, December 29, 2010

HTTP/HTTPS -- Deploy a basic CGI application

The default apache configuration allows execution of CGI scripts in the /var/www/cgi-bin/ directory. This is controlled by the ExecCGI option for a specified directory. A good reference for this is at http://www.brennan.id.au/13-Apache_Web_Server.html#cgi

An example of this is below


    Options ExecCGI
    SetHandler cgi-script

Once a script is included in the target directory, it will begin to respond as an executable. A sample cgi script is below to test with, more can be found online with a simple search
helloworld.cgi
#!/usr/bin/perl
print "Content-Type: text/plain", "\n\n";
print "Hello World in Perl", "\n";

No comments: