Tag Archives: primary script unknown

[Solved] Primary script unknown in nginx configuration PHP

Cause

In the past two days, when building the virtual host, the environment is basically configured. There is no problem in accessing the HTML file, but there is a file not found error when accessing the PHP file

Solution

When there is a problem, first open the log to find the error message

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

Well, if you don’t understand it, you can go directly to Baidu, and then according to the various results of Baidu, the attempt is failed, such as this one

fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
change to
SCRIPT_FILENAME $document_root$fastcgi_script_name; 

But my nginx configuration file is already like this, and then I started to compare the nginx configuration of the server running normally with my current nginx configuration. After comparison, the two are the same, so the problem is not nginx

Then continue to search by chance, try all kinds of things, and finally find a solution

/etc/selinux/config  mid
SELINUX=enforcing
to
SELINUX=disabled

If it hasn’t been solved, consider the issue of permissions

It’s over

If problems are not solved, they will come back again

<?php
  echo 'How can't this input box be removed?';