# Bug in NginxHttpFcgiModule's fastcgi\_split\_path\_info function?

**URL:** <https://www.ruby-forum.com/t/bug-in-nginxhttpfcgimodules-fastcgi-split-path-info-function/198900>\
**Category:** NGINX\
**Created:** [November 10, 2010, 12:09pm UTC](https://www.ruby-forum.com/t/bug-in-nginxhttpfcgimodules-fastcgi-split-path-info-function/198900 "2010-11-10T12:09:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 10, 2010, 12:09pm UTC](https://www.ruby-forum.com/t/bug-in-nginxhttpfcgimodules-fastcgi-split-path-info-function/198900/1 "2010-11-10T12:09:33Z")

</div>

While using Ubuntu 10.10+Nginx 0.8.53+gnosek’s fcgiwrap to serve a  
Mailman mailing list server  
[http://www.gnu.org/software/mailman/index.html](http://www.gnu.org/software/mailman/index.html), that was installed as  
stated in [http://wiki.nginx.org/Mailman](http://wiki.nginx.org/Mailman), I keep getting the error:

[error] FastCGI sent in stderr: “Cannot get script name, is  
DOCUMENT\_ROOT and SCRIPT\_NAME set and is the script executable?”

These attempts were successful:  
[http://mail.example.com/](http://mail.example.com/) =\> shows standard Mailman Welcome page,  
browser bar shows: [http://mail.example.com/mailman/listinfo](http://mail.example.com/mailman/listinfo)  
[http://mail.example.com/listinfo](http://mail.example.com/listinfo) =\> shows standard Mailman Welcome  
page, this time browser bar shows: [http://mail.example.com/listinfo](http://mail.example.com/listinfo)  
[http://mail.example.com/admin](http://mail.example.com/admin) =\> shows standard Mailman Admin Links  
page, browser bar shows: [http://mail.example.com/admin](http://mail.example.com/admin)  
[http://mail.example.com/images/mailman/](http://mail.example.com/images/mailman/) =\> shows “403 Forbidden”  
page, as expected [http://mail.example.com/pipermail/](http://mail.example.com/pipermail/) =\> shows “Index  
of /pipermail/” page, as expected  
[http://mail.example.com/mailman/private](http://mail.example.com/mailman/private) =\> shows “You must specify a  
list.”, as expected

All other attempts were unsuccessful, such as:  
Clicking in “the mailing list overview page” link  
[http://mail.example.com/cgi-bin/mailman/listinfo](http://mail.example.com/cgi-bin/mailman/listinfo) or on the “List”  
“Mailman” link,

Those only output a “403” (produced by fcgiwrap?)

And the nginx error log shows:  
[error] 1181#0: \*17 FastCGI sent in  
stderr: “Cannot get script name, is DOCUMENT\_ROOT and SCRIPT\_NAME  
set and is the script executable?” while reading response header  
from upstream, client: 127.0.1.1,  
server: [mail.example.com](http://mail.example.com),  
request: “GET /cgi-bin/mailman/listinfo HTTP/1.1”,  
upstream: “fastcgi://unix:/var/run/fcgiwrap.socket:”,  
host: “[mail.example.com](http://mail.example.com)”,  
referrer: “[http://mail.example.com/admin](http://mail.example.com/admin)”

My nginx file has:  
server {  
listen 80;  
server\_name [mail.example.com](http://mail.example.com);  
root /usr/lib/cgi-bin;  
location = / {  
rewrite ^ /mailman/listinfo permanent;  
}  
location / {  
rewrite ^ /mailman$uri;  
}  
location /mailman/ {  
fastcgi\_split\_path\_info (^/mailman/[^/]_)(._)$;  
#include /etc/nginx/fastcgi\_params;  
include fastcgi\_params;  
fastcgi\_param GATEWAY\_INTERFACE CGI/1.1;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
fastcgi\_param PATH\_INFO $fastcgi\_path\_info;  
fastcgi\_param PATH\_TRANSLATED  
$document\_root$fastcgi\_path\_info; fastcgi\_pass  
unix:/var/run/fcgiwrap.socket;  
}  
location /images/mailman {  
alias /var/lib/mailman/icons;  
}  
location /pipermail {  
alias /var/lib/mailman/archives/public;  
autoindex on;  
}  
}

My, default and unchanged, /etc/mailman/mm\_cfg.py, that has:  
DEFAULT\_URL\_PATTERN = ‘http://%s/cgi-bin/mailman/’  
PRIVATE\_ARCHIVE\_URL = ‘/cgi-bin/mailman/private’  
DEFAULT\_EMAIL\_HOST = ‘[mail.example.com](http://mail.example.com)’  
DEFAULT\_URL\_HOST = ‘[mail.example.com](http://mail.example.com)’

My nginx -V  
nginx version: nginx/0.8.53  
TLS SNI support enabled  
configure arguments: --conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
–http-log-path=/var/log/nginx/access.log  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid  
–with-http\_ssl\_module --without-http\_limit\_req\_module  
–without-mail\_pop3\_module --without-mail\_smtp\_module  
–without-mail\_imap\_module --without-http\_uwsgi\_module  
–without-http\_scgi\_module --without-http-cache

## My cat /etc/hosts 127.0.0.1 localhost.localdomain localhost 127.0.1.1 [mail.example.com](http://mail.example.com) mail 127.1.1.1 [www.example.com](http://www.example.com) [example.com](http://example.com)

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [November 10, 2010, 5:47pm UTC](https://www.ruby-forum.com/t/bug-in-nginxhttpfcgimodules-fastcgi-split-path-info-function/198900/2 "2010-11-10T17:47:52Z")

</div>

On Wed, Nov 10, 2010 at 11:03:01AM +0000, Mark A. wrote:

Hi there,

> While using Ubuntu 10.10+Nginx 0.8.53+gnosek’s fcgiwrap to serve a  
> Mailman mailing list server  
> [http://www.gnu.org/software/mailman/index.html](http://www.gnu.org/software/mailman/index.html), that was installed as  
> stated in [http://wiki.nginx.org/Mailman](http://wiki.nginx.org/Mailman), I keep getting the error:
> 
> [error] FastCGI sent in stderr: “Cannot get script name, is  
> DOCUMENT\_ROOT and SCRIPT\_NAME set and is the script executable?”

At first glance, it looks to me as if nginx is doing exactly what you  
told it to. I suspect that a small reconfiguration of mailman will work  
for you.

> These attempts were successful:  
> [http://mail.example.com/](http://mail.example.com/) =\> shows standard Mailman Welcome page,  
> browser bar shows: [http://mail.example.com/mailman/listinfo](http://mail.example.com/mailman/listinfo)

The configuration shows that “/” is (externally) rewritten to  
/mailman/listinfo, which is why that appears in the browser bar.

The browser then makes a fresh request for /mailman/listinfo, which is  
handled by your location /mailman/ {} block, where  
fastcgi\_split\_path\_info  
sets $fastcgi\_script\_name to “/mailman/listinfo”, and $fastcgi\_path\_info  
to  
“”, and things work. Presumably the fastcgi server is able to process  
the file /usr/lib/cgi-bin/mailman/listinfo.

> [http://mail.example.com/listinfo](http://mail.example.com/listinfo) =\> shows standard Mailman Welcome  
> page, this time browser bar shows: [http://mail.example.com/listinfo](http://mail.example.com/listinfo)

Here, /listinfo is handled by the location / {} block, which does a  
rewrite (internally) to /mailman/listinfo, which is handled the same as  
in the previous case, and things work.

> [http://mail.example.com/admin](http://mail.example.com/admin) =\> shows standard Mailman Admin Links  
> page, browser bar shows: [http://mail.example.com/admin](http://mail.example.com/admin)

Analogous to /listinfo, internal rewrite to /mailman/admin,  
$fastcgi\_script\_name is “/mailman/admin”, $fastcgi\_path\_info is “”,  
things work.

> [http://mail.example.com/images/mailman/](http://mail.example.com/images/mailman/) =\> shows “403 Forbidden”  
> page, as expected [http://mail.example.com/pipermail/](http://mail.example.com/pipermail/) =\> shows “Index  
> of /pipermail/” page, as expected  
> [http://mail.example.com/mailman/private](http://mail.example.com/mailman/private) =\> shows “You must specify a  
> list.”, as expected

The first two have separate location blocks; the third is similar to  
the redirected initial request above.

> All other attempts were unsuccessful, such as:  
> Clicking in “the mailing list overview page” link  
> [http://mail.example.com/cgi-bin/mailman/listinfo](http://mail.example.com/cgi-bin/mailman/listinfo) or on the “List”  
> “Mailman” link,

Same as /listinfo case, handled by the location / {} block, internal  
rewrite to /mailman/cgi-bin/mailman/listinfo, $fastcgi\_script\_name is  
“/mailman/cgi-bin”, $fastcgi\_path\_info is “/mailman/listinfo”, and  
things don’t work on the fastcgi server because it can’t find the file  
to process. There probably is no file /usr/lib/cgi-bin/mailman/cgi-bin.

To make things work for you, you could probably try a new “location  
/cgi-bin/ {}” block which rewrites to the same url without the  
“/cgi-bin”  
at the start.

But it seems more sensible to just…

> My, default and unchanged, /etc/mailman/mm\_cfg.py, that has:  
> DEFAULT\_URL\_PATTERN = ‘http://%s/cgi-bin/mailman/’  
> PRIVATE\_ARCHIVE\_URL = ‘/cgi-bin/mailman/private’  
> DEFAULT\_EMAIL\_HOST = ‘[mail.example.com](http://mail.example.com)’  
> DEFAULT\_URL\_HOST = ‘[mail.example.com](http://mail.example.com)’

…remove the string “/cgi-bin” from two lines up there. (And you could  
probably even remove the “/mailman” too.) Your nginx is not configured  
to serve from the /cgi-bin urls, but is from the others.

(Note: I haven’t tested any of this.)

The page [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/Mailman) suggests to configure mailman by  
following a separate website. Possibly the information has gotten out  
of sync.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
