所以我试图在debian wheezy服务器上第一次运行php5-fpm的nginx web服务器
打一个PHP文件显示简单的File not found
我已经做了研究(实际上浪费了很多时间),有很多人有类似的问题,但我没有成功地纠正它与他们的工作。
我仍然有同样的错误:
$ 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在stderr中发送:“主脚本未知” ,从上游读取响应头时,
我已经尝试了很多东西,很难记住什么。
我已经把我的configuration文件在github上
目前,nginx.confconfiguration使用这个…
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包含listen = 127.0.0.1:9000
我已经尝试了unix套接字版本,同样的事情。 fastcgi_pass unix:/var/run/php5-fpm.sock;
我确保服务器启动
$ 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
每次修改nginx.conf文件,我都要确保重新启动这个命令
nginx -t && nginx -s reload && echo "nginx configuration reloaded"
和php5-fpm相同的东西
/etc/init.d/php5-fpm restart
谢谢你的帮助 :-)
摆脱了
chroot = /var/www
在您的fpm池configuration。 否则php-fpm将无法访问/ srv。