To test if PHP was installed successfully, Nginx error: "Primary script Unknown"

Source: Internet
Author: User

Niche Blog: http://xsboke.blog.51cto.com

Niche Q q:1770058260
-------Thank you for your reference, if you have any questions, please contact

  1. Environment
    php-5.6.36
    nginx-1.14.0
  2. Problem
    Access PHP test file times 404 (file does not exist), has confirmed that the permissions and configuration are not a problem.
  3. Processing process
    View Nginx error log: reported the following error (172.16.6.236 is the server)
    2018/08/03 01:05:34 [error] 57141#0: *242 FastCGI sent in stderr: "Primary script unknown" while readingresponse header from upstream, client: 172.16.6.237, server: localhost, request: "GET /test.php HTTP/1.1",upstream: "fastcgi://127.0.0.1:9000", host: "172.16.6.236"
  4. Resolution process
    In the Nginx official website to see if there are similar errors, found no, and then Baidu .... (Laugh and Cry)
    The solution is as follows,
    Will:#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    Modified to:fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    location ~ \.php$ {        root           html;        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        include        fastcgi_params;    }

    Explain:$document_root 就是nginx配置项“root”指定的位置参数的变量

To test if PHP was installed successfully, Nginx error: "Primary script Unknown"

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.