Score:0

Lighttpd CGI downloads .py instead of running it

us flag

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"                                      
$                     
Jaromanda X avatar
ru flag
as a test, reverse the order inside `cgi.assign`
us flag
@JaromandaX Nope, does not help.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.