After successfully compiling the installation Nginx 1.4, PHP 5.4 and successfully starting Nginx and PHP-FPM on CentOS, access the PHP prompt "File not found." And see in the error log:
Copy Code code as follows:
2013/10/22 20:05:49 [ERROR] 12691#0: *6 FastCGI sent in stderr: ' Primary script unknown ' while reading response header fro M upstream, client:192.168.168.1, server:localhost, Request: "get/http/1.1", Upstream: "fastcgi://127.0.0.1:9000", hos T: "192.168.168.133"
Error Resolution:
Locate the definition of the calling script file in the Nginx configuration file, such as:
Copy Code code as follows:
Fastcgi_param Script_filename/scripts$fastcgi_script_name;
Modified into the following way ($document _root):
Copy Code code as follows:
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Tips:
The $document _root represents the value specified in the root directive for the current request. Such as:
Copy Code code as follows:
Location/{
root/usr/local/nginx/html;
Index index.php index.html index.htm;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
}
The $document_root in the above configuration is for parsing the PHP files in the/usr/local/nginx/html directory.