Why are my CGI scripts not executed like PHP ?

Aleksandar Lazic al-nginx at none.at
Tue Apr 10 20:54:32 UTC 2018


Hi,

Am 06.04.2018 um 21:53 schrieb Ralph Seichter:
> On 06.04.18 19:04, Richard Stanway wrote:
> 
>> https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/
> 
> I altered my setup to use fcgiwrap. Since then, I keep getting "502 Bad
> Gateway" errors, with log entries like this:
> 
>   2018/04/06 21:21:02 [error] 17838#0: *1 upstream prematurely closed
>   FastCGI stdout while reading response header from upstream, client:
>   123.234.123.234, server: test.mydomain.tld, request: "GET / HTTP/1.1",
>   upstream: "fastcgi://unix:/tmp/cgi.sock:", host: "test.mydomain.tld:8443"
> 
> I use fcgiwrap 1.1.0 from 2013, which appears to be the latest available
> release according to https://github.com/gnosek/fcgiwrap.

Even you have found a working solution you can take a look into uwsgi as
cgi daemon.

https://uwsgi-docs.readthedocs.io/en/latest/CGI.html

It's a quite powerful and robust peace of software any it's active
developed. Latest release is from 20180226

Regards
aleks

> I tried both
> the Perl script at the location you linked and spawn-fcgi 1.6.4 as an
> alternative, but the 502 error pops up regardlesss. Permissions for the
> socket are as follows:
> 
>   $ ls -l /tmp/cgi.sock
>   srwx------ 1 nginx nginx 0 Apr  6 21:48 /tmp/cgi.sock=
> 
> Interestingly I found this old message of Richard's:
> 
>   http://mailman.nginx.org/pipermail/nginx/2014-January/041963.html
> 
> Unfortunately no amount of meddling with SCRIPT_FILENAME, including
> setting the absolute path to the CGI script, made any difference for me.
> 
> I don't know how to debug this further. Development of fcgiwrap seems to
> have ended years ago and the project page is no longer connected. I'd be
> grateful for more ideas how to solve this puzzle.
> 
> -Ralph
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
> 



More information about the nginx mailing list