当前位置: > CentOS > CentOS故障 >

nginx+php 出现404错误解决方法

时间:2014-04-09 17:03来源:www.it.net.cn 作者:IT网
装好 nginx-1.0.5 与 php-5.3.6(php-fpm) 迫不及待的测试 info.php(<?php phpinfo(); ?>),但是只返回了空白页,什么也没有输出,以下是错误日志。




192.168.6.82 - - [01/Aug/2011:13:54:20 +0800] "GET /info.php HTTP/1.1" 404 5 "-" "Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.9) Gecko/20100827 Red Hat/3.6.9-2.el6 Firefox/3.6.9"
192.168.6.82 - - [01/Aug/2011:14:57:30 +0800] "HEAD /info.php HTTP/1.1" 404 0 "-" "curl/7.19.7(x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.6.2 zlib/1.2.3 libidn/1.18 libssh2/1.2.2"
192.168.6.82 - - [01/Aug/2011:13:58:57 +0800] "GET /index.html HTTP/1.1" 200 151 "-" "Mozilla/5.0(X11; U; Linux x86_64; zh-CN; rv:1.9.2.9) Gecko/20100827 Red Hat/3.6.9-2.el6 Firefox/3.6.9"




在nginx.conf配置文档

location ~ \.php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
include        fastcgi_params;
}

更改为




location ~ \.php$ {
root           /data/web;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME /data/web$fastcgi_script_name;
include        fastcgi_params;
}




转载自:http://dngood.blog.51cto.com/446195/628699




(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容