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

Hello,

I went to setup Nginx with php-fpm.

I have3 vhosts for the moment .
I made a script to create vhost and pool file for php-fpm.

I don’t know why but my firsts 2 vhosts work but not the third, i obtain
this message in a blank page :
File not found.

So, in my log error file :
2012/09/24 00:57:12 [error] 23782#0: *422 FastCGI sent in stderr:
“Primary
script unknown” while reading response header from upstream, client:
XX.XX.XX.XX, server: domain.com, request: “GET /phpinfo.php HTTP/1.1”,
upstream: “fastcgi://127.0.0.1:9003”, host: “www.domain.com

This is my vhost :

server {
listen 80;
server_name domain.com www.domain.com;
if ($host !~* ^www.){
rewrite ^(.*)$ $scheme://www.domain.com;
}
root /home/domain/www;
index index.html index.htm index.php;

access_log /home/domain/logs/domain-access.log;
error_log /home/domain/logs/domain-error.log;

   location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
       access_log        off;
       error_log     off;
       expires           max;
       add_header Pragma public;
       add_header Cache-Control "public, must-revalidate,

proxy-revalidate";
}

   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /usr/share/nginx/www;
   }
   fastcgi_intercept_errors on;
   location ~ \.php$ {
       fastcgi_pass   127.0.0.1:9003;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME

$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}

and php-fpm pool :

; Nom du pool
[domain]
; On utilisera une socket
listen = 127.0.0.1:9003

; Permission pour la socket
listen.owner = domain
listen.group = domain
listen.mode = 0666
listen.backlog = -1

; Utilsateur/Groupe des processus
user = domain
group = domain

; On choisira une gestion dynamique des processus
pm = dynamic

pm.max_children = 10
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5

request_terminate_timeout = 2
request_slowlog_timeout = 1
slowlog = /home/domain/logs/domain-slow.log

chroot = /home/domain/
; Chdir to this directory at the start. This value must be an
absolute
path.
; Default Value: current directory or / when chroot
chdir = /www/
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

; Quelques directives de configuration de PHP
php_flag[display_errors] = on
php_admin_value[error_log] = /logs/php_err_domain.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 1M
php_admin_value[upload_max_filesize]= 8M
php_value[max_execution_time] = 2
php_value[include_path] = .:/usr/share/pear:/usr/share/php

Do you have an idea why i have this error ?

Posted at Nginx Forum:

On 24 Sep2012, at 03:40 , chatchat [email protected] wrote:

Hello,

I went to setup Nginx with php-fpm.

I have3 vhosts for the moment .
I made a script to create vhost and pool file for php-fpm.

According to your configs, php chroot into /home/domain/ directory,
and SCRIPT_FILENAME in case of /phpinfo.php is setted to
/home/domain/www/phpinfo.php.
So php look for php script file with relative path
/home/domain/www/phpinfo.php and
absolute path /home/domain/home/domain/www/phpinfo.php and can not find
it.

i think it would be a bug.
it’s ok, if i set the document root as the top level folder,or like your
problem too.

    location ~ \.php$ {
        root           /web;    # ok
        #root           /web/htdocs; #  your problem
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME

$document_root$fastcgi_script_name;
include fastcgi_params;
}

i do’t know how to deal with.
the version is nginx-1.2.4

Posted at Nginx Forum: