Nginx fastcgi Error Primary script unknown solution _nginx

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.