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

摘要: 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. iOS-- pod常用命令

  2. 【NOIP 2004】虫食算

    因为一天机房都是断网状态,校内的小V评测这道题总显示Unaccept,所以下午放学后就和xiaoyimi晚上回家自习,来做一做这道题. 搜索+剪枝优化: 一开始我是顺着低位向高位填数,这么暴力在Vij ...

  3. python之旅2

    python基础 1整数 查看整数类型的方法 >>> a = 1 >>> dir(a) ['__abs__', '__add__', '__and__', '__c ...

  4. 微信扫码支付 php

    仔细看了一遍官方的那幅流程图,我来简化理解一下(注意:我这里针对的是扫码支付模式一,模式二没什么说的)网站后台生成二维码,当然是跟据前台传来的参数有条件的生成买家扫描二维码,扫描过程中,微信后台系统回 ...

  5. asp.net MVC中使用entity framework出现从 datetime2 数据类型到 datetime 数据类型的转换产生一个超出范围的值”的处理

    方法一: 使用DateTime类型的字段在作为参数传入到数据库前记得赋值,并日期要大于1753年1月1日. 方法二: 将DateTime类型的字段修改为DateTime?类型,由于可空类型的默认值都是 ...

  6. python 列表与元组的操作简介

    上一篇:Python 序列通用操作介绍 列表 列表是可变的(mutable)--可以改变列表的内容,这不同于字符串和元组,字符串和元组都是不可变的.接下来讨论一下列表所提供的方法. list函数 可以 ...

  7. ActiveMQ;RabbitMQ;ZeroMQ

    中间件类型: Embedded middleware: As the name suggests, this typeof middleware handles embedded applicatio ...

  8. AutoIt3(AU3)开发的智能驱动安装工具,用于系统封装,支持参数静默启动

    项目相关地址 源码:https://github.com/easonjim/Smart_Driver bug提交:https://github.com/easonjim/Smart_Driver

  9. Python简介及环境部署

    Python的由来:         Python的创始人:Guido van Rossum Guido 在1989年12月时,寻找一门“课余”编程项目来打发圣诞节前后的时间.Guido决定为当时正构 ...

  10. win7下firefox浏览器不能使用

    win7下firefox浏览器不能使用,只有360浏览器才能使用. 使用360安全卫士,到更多工具里面选择"LSP修复",就可以了. 原来是因为安装了土豆加速,然后卸载导致的. 看 ...