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

2974d09ac2541e892966b762aad84943?d=identicon&s=25 chatchat (Guest)
on 2012-09-24 01:41
(Received via mailing list)
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:
http://forum.nginx.org/read.php?2,230967,230967#msg-230967
97b81453789bfb9cb8a3f11e71ca3017?d=identicon&s=25 Sergey Budnevitch (Guest)
on 2012-09-24 12:31
(Received via mailing list)
On 24  Sep2012, at 03:40 , chatchat <nginx-forum@nginx.us> 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.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 cmpan (Guest)
on 2012-10-31 16:41
(Received via mailing list)
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:
http://forum.nginx.org/read.php?2,230967,232432#msg-232432
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.