Welcome! Log In Create A New Profile

Advanced

Re: nginx 1.0.3 with php-fpm, php report 404 error

baalchina
May 27, 2011 12:12AM
thanks!

I moved location ~\.php to location \,works fine now.

2011/5/27 任晓磊 <julyclyde@gmail.com>

> location ~ \.php$ should be a part of location /
> Or else, nginx cannot determine $document_root
>
>
> 在 2011-5-27,上午11:26, baalchina 写道:
>
> 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@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
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
>


--
from:baalchina
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx 1.0.3 with php-fpm, php report 404 error

baalchina May 26, 2011 11:28PM

Re: nginx 1.0.3 with php-fpm, php report 404 error

edogawaconan May 26, 2011 11:44PM

Re: nginx 1.0.3 with php-fpm, php report 404 error

任晓磊 May 26, 2011 11:56PM

Re: nginx 1.0.3 with php-fpm, php report 404 error

baalchina May 27, 2011 12:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 289
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready