php-fpm向nginx返回空的响应

nginx通过fastcgi连接到php-fpm,使用位置块中的标准/etc/nginx/fastcgi_params

当从命令行使用cgi-fcgi -bind -bind连接到/.status(php-fpm.ini :: ping.path)时,结果会按预期返回(X-Powered-By set,response body等)。

当用nginx请求时,结果会回到空(X-Powered-By集合,没有主体长度或内容)。 nginx返回200,因为它得到了“有效”的响应。

看着tcpdump,我在FCGI头文件中隔离了对奇偶校验的请求(减去shell设置的用户相关的envvariables)。

标准的factcgi_params文件不包含SCRIPT_FILENAME的关键行。

 location ~ \.php$ { include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; } 

添加它并重新启动nginx。

那么,你的问题有点含糊。 所谓的“死亡白银”(WSOD)可能会由无数的事情触发。 但是,如果遇到这个问题,我会做一些事情:

  • 在你的php.ini激活以下内容:

     display_errors = 1 display_startup_errors = 1 error_log = /path/to/file error_reporting = -1 ; (the -1 activates absolutely everything) log_errors = 1 
  • 在你的php-fpm.conf激活:

     error_log = /path/to/file 
  • 激活每个php-fpm池configuration:

     catch_workers_output = 1 
  • 重复您的请求并检查所有日志(包括nginx错误日志)
  • 增加日志logging级别(例如,在nginx上debugging)

如果没有任何事情可以帮助你解决问题,那么请发布你的完整的系统信息和configuration。 没有这个,没有人能给你一个确切的答案。