牛骨文教育服务平台(让学习变的简单)
博文笔记

解析Linux Nginx无法解析php的方法

创建时间:2016-10-17 投稿人: 浏览次数:4968

当用Nginx+php-fpm方式使用php的时候,如果访问php文件出现file not found的问题可以用如下方法解决

将root注释掉,并且修改fastcgi_param为SCRIPT_FILENAME  $document_root$fastcgi_script_name;

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  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。