今天帮朋友配置Nginx+PHP环境时,启动后访问php显示空白页面,经过搜索得知 fastcgi_params 文件(部分版本是fastcgi.conf,主要看 nginx.conf 的include路径),配置文件缺少一行:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

--------------------以下内容来自网络--------------------

这句话是干嘛的呢 其实他就是定义php中用到的服务器变量 也就是$_SERVER 

http://wiki.nginx.org/NginxHttpFcgiModule 这个网址下有这么一句话

This module allows Nginx to interact with FastCGI processes and control what parameters are passed to the process。

其实也就是服务器像你的处理php的cgi传递过去他需要的一些参数,而至少要有下面的两个参数php才能执行起来

Below is an example of the minimally necessary parameters for PHP:

fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name;

fastcgi_param QUERY_STRING $query_string;

Parameter SCRIPT_FILENAME is used by PHP for determining the name of script to execute, and QUERY_STRING contains the parameters of the request. 

所以 我们在没有定义SCRIPT_FILENAME这个系统变量的时候 php是没法解释执行的