排行榜 统计
  • 文章总数:1028 篇
  • 评论总数:5 条
  • 分类总数:7 个
  • 最后更新:昨天 14:16

linux环境配置nginx服务访问PHP文件出现:File not found错误

本文阅读 1 分钟
首页 Linux教程 正文
55Link友情链接交易平台

出现File not found错误处理,分两种情况

1、php-fpm找不到SCRIPT_FILENAME里执行的php文件

2、php-fpm不能访问所执行的php,也就是权限问题

第一种情况:更改配置文件nginx.conf 

    location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$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可执行目录sbin下,输入命令./nginx -s reload 即可

第二种情况
两种解决方法: 
第一种,就是把你root文件夹设为其他用户允许 
第二种,找到你的php-fpm的配置文件,找到下面这段,把apache替换成你要的用户组

; RPM: apache Choosed to be able to access some dir as httpd 
user = www
; RPM: Keep a group allowed to write in log dir. 
group = www
 

本文来自投稿,不代表本站立场,如若转载,请注明出处:https://typecho.firshare.cn/archives/489.html
-- 展开阅读全文 --
Virtualbox虚拟机安装宝塔面板外网无法访问面板解决办法
« 上一篇 09-05
Linux报鉴定错误解决办法
下一篇 » 09-05