我有一个在 127.0.0.1:9000 上运行的“hello world”fastcgi,并希望通过 nginx 为其提供服务。我将以下几行添加到 nginx.conf http 块中:
server {
listen public.ip.address.here:80;
server_name $host;
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我没有得到 fastcgi 的输出,而是只得到 502 Bad Gateway 响应。
error_log 说:[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"