Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 :-)

share|improve this question
    
    
all you posted here looks okay to me. What does your config for the fpm pool look like? Do you chroot it into some directory? –  etagenklo Oct 26 '13 at 22:05
    
What script are you trying to run, and where did you put it in your filesystem? –  Michael Hampton Oct 26 '13 at 22:21
    
@etagenklo thanks. I didn't do anything special for the fpm pool. I've just put my /etc/php5/fpm/pool.d/www.conf on github –  jmfayard Oct 26 '13 at 22:24
1  
get rid of this: chroot = /var/www –  etagenklo Oct 27 '13 at 5:16

1 Answer 1

up vote 0 down vote accepted

Get rid of the

chroot = /var/www

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

share|improve this answer
    
Brillant, that was it ! –  jmfayard Oct 28 '13 at 7:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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