Nginx error: “Primary script unknown” while reading response header from upstream

centosnginxphp-fpmweb-server

I have installed Nginx 1.6.2 with PHP-FPM (PHP 5.5.18) under CentOS 6.6 server. I didn't touch nothing else but /etc/nginx/conf.d/default.conf file where I made some changes (see below):

server {
    listen       80;
    server_name  webvm devserver ;

    location / {
        root   /var/www/html;
        index  index.php index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files      $uri =404;
        root           /var/www/html;
        include        fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    }
}

After restart Nginx and try to access http://devserver/index.php file I get this error:

2014/12/01 19:48:51 [error] 5014#0: *6 FastCGI sent in stderr:
"Primary script unknown" while reading response header from upstream,
client: 192.168.3.1, server: webvm, request: "GET /index.php
HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "devserver"

I have checked also permissions/owner for /var/www/html with ls -l command and this is the output:

#ls -l /var/www/html/
total 4
-rw-r--r-- 1 root root 23 Dec  1 19:29 index.php

I did not touch anything under PHP-FPM pool so /etc/php-fpm.d/www.conf have the default configuration:

listen = 127.0.0.1:9000
user = apache
group = apache

Could be permissions the issue?

I have read several posts here (as for example 1,2,3) talking around the same error and possible solutions and tried to apply to my situation but can't get it to works so I need some help here from any, what I'm doing wrong?

Note: I get out commented lines from the file showed since aren't relevant

Best Answer

For me issue with "Primary script unknown" while reading response header from upstream was, that one of php extensions got uninstalled, while it's config was still on disk (specifically it was redis module). Checking /etc/php/XX/pool.d/* against what modules have config (.ini files) and should be installed (or config should be removed) fixed issue. After installing one missing module all started to work again.

It wasn't NGINX fault, but PHP extensions issue.