我突然收到502 Bad gateway错误,我不明白为什么会出现此错误。此错误仅出现在1个单页!! ...
我的Nginx日志中的确切错误是:
Upstream prematurely closed FastCGI stdout while reading response header from upstream [..] upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"
我试过了:
我的/var/log/upstart/php5-fpm.log(只有很多通知):
Terminating...
exiting, bye-bye!
fpm is running, pid 9887
ready to handle connections
systemd monitor interval set to 10000ms
这让我疯了,不知道吗?
答案 0 :(得分:0)
我对服务器nginx配置执行了以下操作:
client_body_timeout 1200;
client_header_timeout 600;
并将zend_extension添加到php fpm php.ini:
zend_extension = xdebug.so
答案 1 :(得分:0)
尝试在源文件中include <fcgi_stdio.h>
。
刚才我发生了此错误,然后在我的include <fcgi_stdio.h>
文件中添加了c
,这是我的代码。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcgi_config.h>
#include <fcgi_stdio.h>
int main()
{
int count = 0;
while(FCGI_Accept() >= 0)
{
printf("content-type:text/html\r\n");
printf("\r\n");
printf("<title>Fast CGI Hello</title>");
printf("<h1>fast CGI hello</h1>");
printf("Request number %d running on host<i>%s</i>\n",++count,getenv("SERVER_NAME"));
}
return 0;
}