upstream closed prematurely FastCGI stdout while reading response header from upstream,

Alexander Skwar alexanders.mailinglists+nospam at gmail.com
Thu Jul 8 16:34:24 MSD 2010


Hello.

I'm trying to setup nginx 0.8.29 on an internal Solaris 10 system, so
that it can
serve simple CGI scripts. I read http://wiki.nginx.org/NginxSimpleCGI
and I'm trying
to follow this setup.

When I try to exec a cgi script (by running eg. "wget
http://rpe-wgs.win.ch.da.rtr/RACE-CGI/test.cgi"),
wget client prints "ERROR 502: Bad Gateway." and in the nginx logs,
there's this:

==> /var/opt/local/nginx/logs/access.log <==
10.0.4.20 - - [08/Jul/2010:13:48:28 +0200] "GET /RACE-CGI/test.cgi
HTTP/1.0" 502 383 "-" "Wget/1.12 (linux-gnu)" "-"

==> /var/opt/local/nginx/logs/error.log <==
2010/07/08 13:48:28 [error] 16479#0: *40 upstream closed prematurely
FastCGI stdout while reading response header from upstream, client:
10.0.4.20, server: rpe-wgs.win.ch.da.rtr, request: "GET
/RACE-CGI/test.cgi HTTP/1.0", upstream:
"fastcgi://unix:/var/opt/local/nginx/fastcgi_temp/cgiwrap-dispatch.sock:",
host: "rpe-wgs.win.ch.da.rtr"

You can find the test.cgi on http://paste.pocoo.org/show/234959/. I'm
rather sure, that
test.cgi did NOT get executed at all; reason: in the test.cgi shell
script, there's a command
"mkdir -p /tmp/testcgi". This command gets executed all the time, if
the script get executed.
But there's no /tmp/testcgi directory on my server and the permissions
of /tmp are
good (ie. 1777); permissions of test.cgi are also good: 0755.

In my nginx.conf, there's this (complete file at
http://paste.pocoo.org/show/234957/):

        location ~ ^/RACE-CGI/.*\.cgi$ {
            gzip off;
            fastcgi_pass
unix:/var/opt/local/nginx/fastcgi_temp/cgiwrap-dispatch.sock;
            fastcgi_index index.cgi;

            fastcgi_param SCRIPT_FILENAME    /opt/service/$fastcgi_script_name;
            include       fastcgi_params;
          }

The socket /var/opt/local/nginx/fastcgi_temp/cgiwrap-dispatch.sock exists:

$ sudo ls -la /var/opt/local/nginx/fastcgi_temp/
total 4
drwx------ 2 webservd webservd 3 2010-07-08 13:48 .
drwxr-xr-x 6 webservd webservd 7 2010-07-08 11:39 ..
srwxr-xr-x 1 webservd webservd 0 2010-07-08 13:48 cgiwrap-dispatch.sock

(Changing the fastcgi_temp directory to 0777 didn't change anything.)

The socket gets created by the cgiwrap-fcgi.pl script, which is
basically the same
one as on http://wiki.nginx.org/NginxSimpleCGI; my version:
http://paste.pocoo.org/show/234956/
Those cgiwrap-fcgi.pl processes ARE running:

$ ps -ef | grep -v grep | grep -i cgiwrap | sort -k 4
webservd 21561 14891   0 13:48:15 ?           0:00 sh -c
/opt/service/scripts/cgiwrap-fcgi.pl
/var/opt/local/nginx/fastcgi_temp/cg
webservd 21563 21561   0 13:48:15 ?           0:00 /opt/csw/bin/perl
/opt/service/scripts/cgiwrap-fcgi.pl /var/opt/local/nginx/fas
webservd 21670 21563   0 13:48:28 ?           0:00 /opt/csw/bin/perl
/opt/service/scripts/cgiwrap-fcgi.pl /var/opt/local/nginx/fas
webservd  1791 21563   0 14:09:47 ?           0:00 /opt/csw/bin/perl
/opt/service/scripts/cgiwrap-fcgi.pl /var/opt/local/nginx/fas
webservd  1814 21563   0 14:09:51 ?           0:00 /opt/csw/bin/perl
/opt/service/scripts/cgiwrap-fcgi.pl /var/opt/local/nginx/fas
webservd  4712 21563   0 14:15:17 ?           0:00 /opt/csw/bin/perl
/opt/service/scripts/cgiwrap-fcgi.pl /var/opt/local/nginx/fas

They get cgiwrap-fcgi.pl gets executed by /etc/svc/method/svc-RTRcgi-fastcgi,
which I run as user webservd. svc-RTRcgi-fastcgi is online at
http://paste.pocoo.org/show/234955/

Here are all the URLs again:

svc-RTRcgi-fastcgi → http://paste.pocoo.org/show/234955/
cgiwrap-fcgi.pl → http://paste.pocoo.org/show/234956/
nginx.conf → http://paste.pocoo.org/show/234957/
fastcgi_params → http://paste.pocoo.org/show/234958/
test.cgi → http://paste.pocoo.org/show/234959/

What's broken? What did I miss to do?

Thanks a lot,

Alexander
--
↯    Lifestream (Twitter, Blog, …) ↣ http://alexs77.soup.io/     ↯
↯ Chat (Jabber/Google Talk) ↣ a.skwar at gmail.com , AIM: alexws77  ↯



More information about the nginx mailing list