Chinaunix

标题: nginx index.php报404的错误 [打印本页]

作者: butterinsect    时间: 2012-04-08 10:39
标题: nginx index.php报404的错误
nginx  index.html 静态页面是正常的,动态页面index.php报404的错误

nginx.conf  中fastcgi的配置,fastcgi_param 下面两种都不可

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

在nginx 的html目录下添加了index.php
<?php
phpinfo();
?>


php-fpm已经起来了,
$ ps -aux | grep php-fpm
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root     12949  0.0  0.1  24768  3156 ?        Ss   10:24   0:00 php-fpm: master process (/opt/php/etc/php-fpm.conf)         
yyt      12950  0.0  0.1  24768  2592 ?        S    10:24   0:00 php-fpm: pool www                                          
yyt      12951  0.0  0.1  24768  3300 ?        S    10:24   0:00 php-fpm: pool www  


php.ini把cgi.fix_pathinfo改为1
cgi.fix_pathinfo=1


ps -aux|grep php ,只看到php-fpm 进程,没有看到php-cgi的进程

谢谢了!
作者: butterinsect    时间: 2012-04-08 11:05
re,期待大神出现
作者: lsstarboy    时间: 2012-04-08 15:59
fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;

这一行要带路径!
比如最常用的是:
/var/www/html$fastcgi_script_name;

作者: butterinsect    时间: 2012-04-09 23:00
回复 3# lsstarboy


    恩,谢谢,解决了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2