Configure lighttpd to handle CGI C executables

Does anyone know how to configure lighttpd to handle simple CGI executables, in this case written in C? I compiled a test program (test.cgi) and put it in $ HOME / public_html / cgi-bin. I also enabled the CGI module with lighty-enable-mod cgi and restarted the web server. However, when you request http: //localhost/~august/cgi-bin/test.cgi, the program does not start, but instead is treated as a static file. Here is my test program:

 #include <stdio.h> int main(void) { printf("Content-type: text/plain\n\n"); puts("test..."); return 0; } 
+4
source share
1 answer

The default CGI configuration is as follows:

 $HTTP["url"] =~ "^/cgi-bin/" { cgi.assign = ( "" => "" ) } 

i.e. only binary files in the cgi-bin directory under the document root will be executed. To enable cgi directories for each user, add

 $HTTP["url"] =~ "^(/~[^/]+)?/cgi-bin/" { cgi.assign = ("" => "") } 

in the lighttpd configuration file.

+7
source

All Articles