Hi Folks,
Enabling mod_cgi,python in lighttpd
Create cgi-bin directory in /var/www
mkdir -p cgi-bin
chown www-data:www-data cgi-bin/
chmod 755 test.py
open lighttpd.conf
vi /etc/lighttpd/lighttpd.conf
append .py extension and save the file
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" )
open 10-cgi.conf
vi /etc/lighttpd/conf-enabled/10-cgi.conf
enable mod_cgi
server.modules += ( "mod_cgi" )
Change the alias.url for your cgi-bin directory
$HTTP["remoteip"] =~ "127.0.0.1" {
alias.url += ( "/cgi-bin/" => "/var/www/cgi-bin/" )
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
}
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.php/.py even outside of /usr/lib/cgi-bin.
#
Uncomment the .py entry and save the file
cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".php" => "/usr/bin/php-cgi",
".py" => "/usr/bin/python",
)
Restart lighttpd
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd start
No comments:
Post a Comment