百度了半天找到别人的解决办法 记录下

摘要: file not found. nginx php 这个问题是你配置文件的问题: 查看就是了不要管 nginx 如何开启解析 PHP 的功能? # 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the PHP scripts to FastCGI

file not found. nginx php

这个问题是你配置文件的问题:

查看就是了不要管
nginx 如何开启解析 PHP 的功能?
# 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”部分的注释

cd /usr/local/php/etc

mv php-fpm.conf.default php-fpm.conf

vi /usr/local/nginx/conf/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;

这一句有问题,请再仔细查想一下为什么?

  • 华晨@kut : 发现了更好的办法,/scripts 改成 $document_root 就好了,呵呵。 (
  • 华晨@kut : 哦,我知道了,把 /scripts 改成 /usr/local/nginx/html 就可以了。我刚才在服务器上试了一下,真的可以找到文件并且成功解析了!十分感谢! (4年前)
  • kut@华晨: /scripts是一个目录名,也就是你站点的根目录,比如说,你访问/index.php这个文件,其实就是访问操作系统中/scripts/index.php这个文件,这个文件是否存在?(4年前)
  •  

重启nginx就可以解析php了。

# 启动 php-fpm 和 nginx
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx

# 在 nginx 的 html 目录下放一个 php 文件,浏览器访问,不能解析,显示“ File not found.”

centos搭建 nginx一直报错 file not found.的更多相关文章

  1. nginx 启动报错“var/run/nginx/nginx.pid" no such file or directory

    nginx 启动报错“var/run/nginx/nginx.pid" no such file or directory 今天刚搭建的nginx服务器启动时,报错“var/run/ngin ...

  2. centos7 安装nginx和php5.6.25遇到 无法访问php页面 报错file not found 问题解决

    php-fpm安装完成,nginx安装完成 netstap -ntl| 发下端口正常开启 iptables -L 返现9000端口已经开放 ps -aux|grep nginx 发下nginx进程正常 ...

  3. 重启虚拟机后,再次重启nginx会报错:[emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)

    问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...

  4. FastDFS整合nginx后,nginx一直报错

    FastDFS整合nginx后,nginx一直报错: 报错内容: [2018-06-11 09:41:21] ERROR - file: ../common/fdfs_http_shared.c, l ...

  5. nginx 启动报错 “/var/run/nginx/nginx.pid" failed” 解决方法

    问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...

  6. Nginx 启动报错 “/var/run/nginx/nginx.pid" failed”

    问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...

  7. centos在yum install报错:Another app is currently holding the yum lock解决方法

    centos在yum install报错:Another app is currently holding the yum lock,这个问题可能是很多的新手经常遇到问题,之前也有人问我,包括本人在刚 ...

  8. Nginx启动报错:10013: An attempt was made to access a socket in a way forbidden

    Nginx在win7,win2008下启动报错:bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket i ...

  9. nginx默认80端口被System占用,造成nginx启动报错的解决方案

    今天启动window上的nginx总是报错 错误信息是bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socke ...

随机推荐

  1. 50-ln 简明笔记

    为文件建立链接 ln [options] existing-file [new-link] ln [options] existing-file-list directory ln可以为一个或多个文件 ...

  2. C# EventHandler and Delegate(委托的使用)

    委托的声明 public delegate void MyDelegate(string str); 注 1.委托的定义和方法的定义类似,只是在前面加了一个delegate,但委托不是方法,它是一种特 ...

  3. Gson解析json数据

    1.解析单个对象 JSON字符串如下 [ { "formatDate":"2015-10-28", "date":"2015\u5 ...

  4. 如何在Ubuntu上配置scala教程

    Scala是一门多范式的编程语言,一种类似java的编程语言,设计初衷是实现可伸缩的语言 .并集成面向对象和函数式变成的各种特性.这里为了学习spark特地配置了scala. 1.下载scala安装包 ...

  5. iOS开发小技巧--学会包装控件(有些view的位置由于代码或系统原因,位置或者尺寸不容易修改或者容易受外界影响)

    一.百思项目中遇到了两处这样的问题, 第一处 - 是评论界面的headerView,由于直接把自己搞的xib加载了放在了那里,xib中setFrame写了好多-=  +=,每次滚动的时候,会频繁调用x ...

  6. nodeJS+bootstarp+mongodb整一个TODO小例子

    又是一个简单的小玩意儿, 不过有个大玩意儿,就是nosql的mongodb(文件大小:130M),  你要下载一个mongdodb, 去官方网站下载 安装以后在mongodb的命令行目录下执行 mon ...

  7. 全面理解Context

    出处:http://blog.csdn.net/lmj623565791/article/details/40481055,本文出自:[张鸿洋的博客] 本文大多数内容翻译自:http://www.do ...

  8. htm.dropdownlist

    @Html.DropDownList("status", new SelectList(new[] { "驳回", "确认", " ...

  9. 【HDU 2874】Connections between cities(LCA)

    dfs找出所有节点所在树及到树根的距离及深度及父亲. i和j在一棵树上,则最短路为dis[i]+dis[j]-dis[LCA(i,j)]*2. #include <cstring> #in ...

  10. IOS URL 编码和解码

    1.url编码 ios中http请求遇到汉字的时候,需要转化成UTF-8,用到的方法是: NSString * encodingString = [urlString stringByAddingPe ...