nginx php5-fpm "File not found" -- FastCGI sent in stderr: "Primary script unknown"
Get rid of the
chroot = /var/www
in your fpm-pool configuration. Otherwise php-fpm won't be able to access /srv.
Related videos on Youtube
jmfayard
Jean-Michel Fayard Digital Enthusiast | Informaticien généraliste Great Just Isn't Good Enough LinkedIN | Viadeo | CV | Resume |Github | Blog | Site perso (en chantier)
Updated on September 18, 2022Comments
-
jmfayard over 1 year
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
containslisten = 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.sockEach 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 :-)
-
jmfayard over 10 years
-
Michael Hampton over 10 yearsWhat script are you trying to run, and where did you put it in your filesystem?
-
jmfayard over 10 years@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 over 10 years@MichaelHampton I put them in a non-standard directory in /srv/data1/test they are simpe php files that call phpinfo() for example. Before I wanted to run Dokuwiki and Dotclear.
-
etagenklo over 10 yearsget rid of this:
chroot = /var/www
-
jmfayard over 10 yearsWow, that whas it. I don't know how I can express my gratitude :) I can't even approve your answer since comments do not count for reputation ;)
-
etagenklo over 10 yearsOk, I did that :)
-
-
jmfayard over 10 yearsBrillant, that was it !