I have two CGI test scripts in lighttpd.
When I open Bash http://host/cgi-bin/test.sh
URL I get a valid response from the script.
But when I open Python http://host/cgi-bin/test.py
the file is downloaded in browser instead of being run by CGI module.
How can I make both Bash and Python work in CGI?
My CGI configuration in lighttpd.conf:
server.modules = (
"mod_access",
"mod_cgi",
"mod_accesslog" )
cgi.assign = ( ".sh" => "/bin/bash",
".py" => "/usr/bin/python" )
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".sh" => "/bin/bash",
".py" => "/usr/bin/python" )
}
Both files have the same permissions and execute from command line as expected.
$ ls -l /www/pages/cgi-bin/
total 8
-rwxr-xr-x 1 root root 96 May 8 12:27 test.py
-rwxr-xr-x 1 root root 19 May 8 12:19 test.sh
$ cat test.sh
#!/bin/bash
echo Hi from Bash
$ cat test.py
#!/usr/bin/python
print "Hi from Python"
$