1

so I'm trying to run for the first time the nginx web server with php5-fpm on a debian wheezy server

Hitting a php file display simply File not found

I have done my research (waste a lot of hours actually ;), there are a lot of people that have similar problems, yet I didn't succeed to correct it with what worked for them.

I still have the same error :

$ tail /var/log/nginx/access.log /var/log/nginx/error.log /var/log/php5-fpm.log | less

==> /var/log/nginx/error.log <==

2013/10/26 21:36:00 [error] 6900#0: *1971 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

I have tried a lot of things, it's hard to remember what.

I have put my config files on github

Currently, the nginx.conf configuration uses this...

server {
  server_name mydomain.tld;
  root /srv/data1/test;

   location ~ \.php$ {
            try_files $uri =404;
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_index   index.php;
            fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include         fastcgi_params;
    }
}

/etc/php5/fpm/pool.d/www.conf contains listen = 127.0.0.1:9000

I have tried the unix socket version, same thing. fastcgi_pass unix:/var/run/php5-fpm.sock;

I made sure the server is started

$ netstat -alnp | grep LISTEN

tcp 0 0 127.0.0.1:9000 0.0.0.0:*
LISTEN 6913/php-fpm.conf) tcp 0 0 127.0.0.1:3306
0.0.0.0:* LISTEN 4785/mysqld tcp 0 0 0.0.0.0:842 0.0.0.0:* LISTEN
2286/inetd tcp 0 0 0.0.0.0:111
0.0.0.0:* LISTEN 2812/rpcbind tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
5710/nginx tcp 0 0 0.0.0.0:22
0.0.0.0:* LISTEN 2560/sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
5710/nginx tcp6 0 0 :::111 :::*
LISTEN 2812/rpcbind unix 2 [ ACC ] STREAM
LISTENING 323648 6574/tmux /tmp//tmux-1000/default
unix 2 [ ACC ] STREAM LISTENING 619072
6790/fcgiwrap /var/run/fcgiwrap.socket unix 2 [ ACC ] SEQPACKET LISTENING 323 464/udevd
/run/udev/control unix 2 [ ACC ] STREAM LISTENING
610686 2812/rpcbind /var/run/rpcbind.sock unix 2 [ ACC ] STREAM LISTENING 318633 4785/mysqld
/var/run/mysqld/mysqld.sock

Each time I modify the nginx.conf file, I make sure to relaunch this command

nginx -t && nginx -s reload && echo "nginx configuration reloaded"

and same thing for php5-fpm

/etc/init.d/php5-fpm restart

Thanks for your help :-)

1

Get rid of the

chroot = /var/www

in your fpm-pool configuration. Otherwise php-fpm won't be able to access /srv.

  • Brillant, that was it ! – jmfayard Oct 28 '13 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.