- 论坛徽章:
- 0
|
配置lighttpd-1.4.20支持CGI
参考:http://www.xianguo.com/go.php?fi=274610229
前面安装了lighttpd-1.4.20,并且成功测试了静态页面,下面尝试访问perl写CGI。这里不描述CGI脚本的详细内容,
主要是讲如何配置lighttpd-1.4.20支持CGI。
写一个简单的CGI脚本,然后通过浏览器访问,结果显示“403 - Forbidden”禁止访问?到官方网站上查找
http://redmine.lighttpd.net/wiki ... entlyAskedQuestions下有这样一段描述
“
Why do I still get a 403 status, even though the permissions on my doc root directory and its contents are set to 755?¶
Nine times out of ten (in IRC support), you have forgotten to check the permissions on one of the parent directories. Double check each directory in your path to insure the lighttpd user can access the nested doc root.
”
又仔细检测一下,发现目录访问权限没有问题
google一下,原来是配置文件里没有启动CGI支持,这里显示修改的内容:
server.modules += ("mod_cgi")
修改配置文件后重新启动:service lighttpd restart。重新访问,还是“403 - Forbidden”。
继续查看配置文件
#### CGI module
#cgi.assign = ( ".pl" => "/usr/bin/perl",
# ".cgi" => "/usr/bin/perl" )
原来前面启动了CGI支持,但是脚本的执行也需要指定可以使用的解释器。改为:
#### CGI module
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl" )
再次重新启动,访问成功^^ |
|