After nginx 1.4 and PHP 5.4 are compiled and installed on centos and nginx and PHP-FPM are started successfully, the "file not found" prompt is displayed when you access PHP. "At the same time, you can see in the error log: copy the Code as follows: 20:05:49 [Error] 12691 #0: * 6 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.168.1, server: localhost, request: "Get/HTTP/1.1", upstream: "FastCGI: // 127.0.0.1: 9000 ", host:" 192.168.168.20." error solution: In the nginx configuration file, locate the location where the script file is called, for example, copy the code. The Code is as follows: fastcgi_param script_filename/scripts $ fastcgi_script_name; change to the following method ($ document_root): copy the Code as follows: fastcgi_param script_filename $ document_root $ fastcgi_script_name: $ document_root indicates the value specified by the current request in the root command. For example, the copy code is as follows: Location/{root/usr/local/nginx/html; Index. PHP index.html index.htm; fastcgi_param script_filename $ document_root $ fastcgi_script_name;} in the above configuration, $ document_root resolves PHP files under the/usr/local/nginx/html directory.
Nginx FastCGI error primary script unknown Solution