[Solved] Nginx-FastCGI-“Primary script unknown” while reading response header from upstream,

After adding fastcgi support to nginx, verify the PHP page and report an error file not found. Check the log display

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

At first, I thought it was a permission problem, so I started to configure it first

location  ~ \.php$ {
          root  /data/nginx/html/php;
          default_type text/html;
          fastcgi_index  index.php;
          #fastcgi_param  SCRIPT_FILENAME /data/nginx/php$fastcgi_script_name;
          fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;   //error
          fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include  fastcgi_params;

It looks like the configuration is the same, in fact, there is a w problem here, I am a direct copy of win to linux,, using nginx -t file is OK, not detected at all, you can download the WinMerge file to compare the upper and lower lines, you can also cat -A detect win spaces.

Similar Posts: