Home   >>   Lighttpd   >>   Configure CGI For Perl Programs in Lighttpd (mod_cgi)
Configure CGI For Perl Programs in Lighttpd (mod_cgi) PDF Print E-mail
( 0 Votes )
How To - Lighttpd
Written by Christian Foronda   
Thursday, 08 April 2010 10:11

Lighttpd has mod_cgi module that allows you running Perl and other server side programs via cgi-bin directory.

Conditional Configuration:

Field name Description
$HTTP["host"] match on host.
$HTTP["url"] match on url. If there are nested blocks, this must be the most inner block.

<operator> is one of:

Operator Value
== string equal match
!= string not equal match
=~ perl style regular expression match
!~ perl style regular expression not match

Configuration:

Open your lighttpd configuration file:

	# vi /etc/lighttpd/lighttpd.conf

Append the add mod_ cgi to list of server modules:

	
server.modules = ( "mod_cgi" )

Usage:

Find out your virtual server configuration and append the following:

	$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = (
".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl"
}
}

Test it:

Create a file /perl program in /home/lighttpd/www/cgi-bin/sample.pl:

	#!/usr/bin/perl
print "Content-Type: text/plain", "\n\n";
print "Hi there! This is a sample perl program!!!", "\n";

Save and execute the program (http://yourdomain.com/cgi-bin/sample.pl).

Reference:

http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:Configuration
http://www.cyberciti.biz/tips/lighttpd-howto-setup-cgi-bin-access-for-perl-programs.html




blog comments powered by Disqus
Last Updated on Thursday, 08 April 2010 10:13