lighttpd: can not run CGI files ('404' error messages for CGI files accessed locally)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lighttpd (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: lighttpd
I am running lighttpd 1.4.19 on Ubuntu 8.04.1.
I have been trying to get CGI scripts running on the server. These scripts will be accessed only from the localhost (and I am not using port 80).
After the following steps:
* enable mod_cgi
* create cgi script cgi.pl in /usr/lib/cgi-bin/ (with 755 permissions)
trying to access the file via the URL http://
After a lot of head-banging and frustration I think the reason for this error is the second line in the below code excerpt from 10-cgi.conf:
$HTTP["remoteip"] == "127.0.0.1" {
alias.url += ( "/cgi-bin/" => "/usr/lib/cgi-bin/" ) #--->CAUSE FOR THE ERROR!!
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".pl" => "/usr/bin/perl" )
}
}
I then found this issue reported within a Debian bug discussion:http://
As mentioned by Vedran Furač, the second alias is superfluous within the 10-cgi.conf file.
Relevant code excerpt from the 10-cgi.conf file:
$HTTP["remoteip"] == "127.0.0.1" {
alias.url += ( "/cgi-bin/" => "/usr/lib/cgi-bin/" ) #--->CAUSE FOR THE ERROR!!
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".pl" => "/usr/bin/perl" )
}
}
The second line results in '404' errors, when trying to execute a CGI file. Commenting it out, solves the problem.
With the default 10-cgi.conf file, running /usr/sbin/lighttpd -tp -f lighttpd.conf
results in this relevant snippet:
$HTTP[
# block 1
alias.url = (
"/doc/" => "/usr/share/doc/",
# 3
)
One can notice the superfluous paths. The relevant error message from the lighttpd error log is:
2008-11-01 15:26:40: (response.c.212) -- splitting Request-URI
2008-11-01 15:26:40: (response.c.213) Request-URI : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (response.c.214) URI-scheme : http
2008-11-01 15:26:40: (response.c.215) URI-authority: 127.0.0.1:8888
2008-11-01 15:26:40: (response.c.216) URI-path : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (response.c.217) URI-query :
2008-11-01 15:26:40: (response.c.267) -- sanatising URI
2008-11-01 15:26:40: (response.c.268) URI-path : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (mod_access.c.135) -- mod_access_
2008-11-01 15:26:40: (response.c.382) -- before doc_root
2008-11-01 15:26:40: (response.c.383) Doc-Root : /var/www/
2008-11-01 15:26:40: (response.c.384) Rel-Path : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (response.c.385) Path :
2008-11-01 15:26:40: (response.c.433) -- after doc_root
2008-11-01 15:26:40: (response.c.434) Doc-Root : /var/www/
2008-11-01 15:26:40: (response.c.435) Rel-Path : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (response.c.436) Path : /var/www/
2008-11-01 15:26:40: (response.c.453) -- logical -> physical
2008-11-01 15:26:40: (response.c.454) Doc-Root : /var/www/
2008-11-01 15:26:40: (response.c.455) Rel-Path : /cgi-bin/cgi.pl
2008-11-01 15:26:40: (response.c.456) Path : /usr/lib/cgi-bin/, /usr/lib/
2008-11-01 15:26:40: (response.c.473) -- handling physical path
2008-11-01 15:26:40: (response.c.474) Path : /usr/lib/cgi-bin/, /usr/lib/
2008-11-01 15:26:40: (response.c.530) -- file not found
2008-11-01 15:26:40: (response.c.531) Path : /usr/lib/cgi-bin/, /usr/lib/
I guess the second alias line needs to be deleted.
thanks,
Deapesh.
Seems like Ubuntu bug Bug #179484 is also due to this issue.