thanks!<br><br>I moved location ~\.php to location \,works fine now.<br><br><div class="gmail_quote">2011/5/27 ÈÎÏþÀÚ <span dir="ltr"><<a href="mailto:julyclyde@gmail.com">julyclyde@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word">location ~ \.php$ should be a part of location /<div>Or else, nginx cannot determine $document_root</div><div><br></div><div><br><div><div>ÔÚ 2011-5-27£¬ÉÏÎç11:26£¬ baalchina дµÀ£º</div><br><blockquote type="cite">
<div><div></div><div class="h5">Hi everyone<br><br>I am using nginx 1.0.3 under CentOS 5.6, with php-fpm.<br><br>nginx works fine with static file, such as html,txt. But not with php file.<br><br>I wrote a phpinfo.php file in my webserver, my browser and nginx log both report an 404 error.<br>
<br>I changed nothing but only add below in my nginx.conf file:<br><br><i>location ~ \.php$ {<br><br>fastcgi_pass <a href="http://127.0.0.1:9000/" target="_blank">127.0.0.1:9000</a>;<br>fastcgi_index index.php;<br>include /usr/local/nginx/conf/fastcgi.conf;<br>
}</i><br><br>this is fastcgi.conf:<br><i><br>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br><br><br>fastcgi_param QUERY_STRING $query_string;<br>fastcgi_param REQUEST_METHOD $request_method;<br>
fastcgi_param CONTENT_TYPE $content_type;<br>fastcgi_param CONTENT_LENGTH $content_length;<br><br>fastcgi_param SCRIPT_NAME $fastcgi_script_name;<br>fastcgi_param REQUEST_URI $request_uri;<br>
fastcgi_param DOCUMENT_URI $document_uri;<br>
fastcgi_param DOCUMENT_ROOT $document_root;<br>fastcgi_param SERVER_PROTOCOL $server_protocol;<br><br>fastcgi_param GATEWAY_INTERFACE CGI/1.1;<br>fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;<br><br>
fastcgi_param REMOTE_ADDR $remote_addr;<br>fastcgi_param REMOTE_PORT $remote_port;<br>fastcgi_param SERVER_ADDR $server_addr;<br>fastcgi_param SERVER_PORT $server_port;<br>fastcgi_param SERVER_NAME $server_name;<br>
<br># PHP only, required if PHP was built with --enable-force-cgi-redirect<br>#fastcgi_param REDIRECT_STATUS 200;</i><br clear="all"><br>and php-fm works fine:<br><i>[root@cacti database]# more /data/logs/php-fpm.log <br>
[27-May-2011 10:04:51] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful<br><br>[27-May-2011 10:07:14] NOTICE: using inherited socket fd=6, "<a href="http://127.0.0.1:9000/" target="_blank">127.0.0.1:9000</a>"<br>
[27-May-2011 10:07:14] NOTICE: fpm is running, pid 25610<br>[27-May-2011 10:07:14] NOTICE: ready to handle connections</i><br><br>and this is nginx access log:<br><br><br><i>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.<br>
1"</i><br><br>so, what is the problely problem of this 404 error?<br><br>thanks!<br>-- <br>from:baalchina<br></div></div><div class="im">
_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br><a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</div></blockquote></div><br></div></div><br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>from:baalchina<br>