To setup cgi-bin access, you have to enable both the mod_alias and mod_cgi in /etc/lighttpd/lighttpd.conf:
server.modules += ( "mod_alias" )
include "mod_cgi.conf"
Lighttpd installation came with a mod_cgi.conf in /etc/lighttpd. Check that file to make sure that it has:
alias.url = ( "/cgi-bin/" => "/var/www/localhost/cgi-bin/" )
$HTTP["url"] =~ "^/cgi-bin/" {
# disable directory listings
dir-listing.activate = "disable"
# only allow cgi's in this directory
cgi.assign = (
".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl"
)
}
Check /etc/lighttpd/lighttpd.conf has the following line:
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
Find out your virtual server configuration and append following text:
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( ".pl" => "/usr/bin/perl" )
}
Here is complete my config code:
$HTTP["host"] =~ "yourhost.com" {
server.document-root = "/home/lighttpd/yourhost.com/http"
server.errorlog = "/var/log/lighttpd/yourhost.com/error.log"
accesslog.filename = "/var/log/lighttpd/yourhost.com/access.log"
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl")
}
}
Comments
Anonymous
July 21, 2009
34 weeks 3 days
Thanks!
Thanks, that was very helpful!