配置lighttpd处理CGI C可执行文件 [英] Configuring lighttpd to handle CGI C executables
问题描述
有人知道如何配置lighttpd来处理普通的CGI可执行文件,在这种情况下是用C编写的?我已经编译了一个测试程序(test.cgi)并将其放在$ HOME/public_html/cgi-bin中.我还使用lighty-enable-mod cgi
启用了CGI模块,并重新启动了Web服务器.不过,当请求 http://localhost/~august/cgi-bin/test.cgi 该程序未运行,而是被视为静态文件.顺便说一下,这是我的测试程序:
Does anyone know how to configure lighttpd to handle plain CGI executables, in this case written in C? I have compiled a test program (test.cgi) and put it in $HOME/public_html/cgi-bin. I have also enabled the CGI module with lighty-enable-mod cgi
and restarted the web server. Still, when requesting http://localhost/~august/cgi-bin/test.cgi the program is not run but is instead treated as a static file. Here is my test program by the way:
#include <stdio.h>
int main(void)
{
printf("Content-type: text/plain\n\n");
puts("test...");
return 0;
}
推荐答案
默认的CGI配置如下:
The default CGI configuration looks like this:
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
即仅执行文档根目录下cgi-bin目录中的二进制文件.要启用每个用户的cgi目录,请添加
i.e. only binaries in the cgi-bin directory under the document root will be executed. To enable per-user cgi directories, add
$HTTP["url"] =~ "^(/~[^/]+)?/cgi-bin/" {
cgi.assign = ("" => "")
}
到lighttpd配置文件.
to the lighttpd configuration file.
这篇关于配置lighttpd处理CGI C可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!