I have a "hello world" fastcgi running on 127.0.0.1:9000 and would like to serve it via nginx. I added the following lines to the nginx.conf http block:
server {
listen public.ip.address.here:80;
server_name $host;
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
However, instead of getting the output of the fastcgi, I only get a 502 Bad Gateway response.
error_log says: [error] 1924#0: *1 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: myIP, server: $host, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "public.ip.address.here"
Best Answer
This sounds like the actual problem is in your FastCGI application. Have a look at it's error log or other output it might have produced.
In general, it might be that your require more FastCGI configuration, to pass on data to your application. A larger setup might include stuff like those settings:
Again, your FastCGI application's output should tell you more, it could also be a completely nginx-unrelated problem