nginx 1.0.3 with php-fpm, php report 404 error

baalchina baalchina at gmail.com
Fri May 27 07:26:24 MSD 2011


Hi everyone

I am using nginx 1.0.3 under CentOS 5.6, with php-fpm.

nginx works fine with static file, such as html,txt. But not with php file.

I wrote a phpinfo.php file in my webserver, my browser  and nginx log both
report an 404 error.

I changed nothing but only add below in my nginx.conf file:

*location ~ \.php$ {

fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
include        /usr/local/nginx/conf/fastcgi.conf;
}*

this is fastcgi.conf:
*
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;


fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
#fastcgi_param  REDIRECT_STATUS    200;*

and php-fm works fine:
*[root at cacti database]# more /data/logs/php-fpm.log
[27-May-2011 10:04:51] NOTICE: configuration file
/usr/local/php/etc/php-fpm.conf test is successful

[27-May-2011 10:07:14] NOTICE: using inherited socket fd=6, "127.0.0.1:9000"
[27-May-2011 10:07:14] NOTICE: fpm is running, pid 25610
[27-May-2011 10:07:14] NOTICE: ready to handle connections*

and this is nginx access log:


*172.17.188.133 - - [27/May/2011:10:46:37 +0800] "GET /info.php HTTP/1.1"
404 5 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101
Firefox/4.0.
1"*

so, what is the problely problem of this 404 error?

thanks!
-- 
from:baalchina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110527/0e6b224b/attachment.html>


More information about the nginx mailing list