完美解决:Nginx访问PHP出现File not found.

目录

解决方法一:

解决方法二:


遇到 File not found. 出现的问题解决:

解决方法一:

修改nginx的主配置文件。

vi /etc/nginx/nginx.conf

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

将 fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 

修改为

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

修改完成后使用下面命令重新加载nginx配置:

nginx -s reload

重新启动nginx

systemctl restart nginx

解决方法二:

修改php-fpm配置文件

vi /etc/php-fpm.d/www.conf

查找apache

:/apache

修改属主和属组,这里我修改为nginx为例。

修改前:

 

修改后: 

修改完毕后重启php-fpm。

systemctl restart php-fpm

猜你喜欢

转载自blog.csdn.net/m0_64304713/article/details/134482927
今日推荐