centos搭建 nginx一直报错 file not found.
百度了半天找到别人的解决办法 记录下
摘要: 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.的更多相关文章
- 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 ...
- centos7 安装nginx和php5.6.25遇到 无法访问php页面 报错file not found 问题解决
php-fpm安装完成,nginx安装完成 netstap -ntl| 发下端口正常开启 iptables -L 返现9000端口已经开放 ps -aux|grep nginx 发下nginx进程正常 ...
- 重启虚拟机后,再次重启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 ...
- FastDFS整合nginx后,nginx一直报错
FastDFS整合nginx后,nginx一直报错: 报错内容: [2018-06-11 09:41:21] ERROR - file: ../common/fdfs_http_shared.c, l ...
- nginx 启动报错 “/var/run/nginx/nginx.pid" failed” 解决方法
问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...
- Nginx 启动报错 “/var/run/nginx/nginx.pid" failed”
问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...
- centos在yum install报错:Another app is currently holding the yum lock解决方法
centos在yum install报错:Another app is currently holding the yum lock,这个问题可能是很多的新手经常遇到问题,之前也有人问我,包括本人在刚 ...
- 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 ...
- nginx默认80端口被System占用,造成nginx启动报错的解决方案
今天启动window上的nginx总是报错 错误信息是bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socke ...
随机推荐
- python2.X和3.X的一些区别【整理中】
1.性能 Py3.0运行 pystone benchmark的速度比Py2.5慢30%.Guido认为Py3.0有极大的优化空间,在字符串和整形操作上可 以取得很好的优化结果. Py3.1性能比P ...
- ElasticSearch入门系列(七)搜索
一.在之前,我们已经学会了如何使用elasticsearch作为一个简单的NoSql风格的分布式文件存储器--我们可以将一个JSON文档扔给Elasticsearch.也可以根据ID检索他们.但Ela ...
- 35-less 简明笔记
分屏显示文本文件 less [options] [file-list] less与more类似,但比more更加完善 例如:在显示一屏文本之后,less将显示提示副等待下一条命令的输入;可以向前或向后 ...
- angularjs实现时钟效果
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 关于web前端的学习路线
第一阶段: HTML+CSS:HTML进阶.CSS进阶.div+css布局.HTML+css整站开发. JavaScript基础:Js基础教程.js内置对象常用方法.常见DOM树操作大全.ECMAsc ...
- iOS开发中的错误整理,Changing the delegate of a tab bar managed by a tab bar controller is not allowed
iOS [错误:'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.'] 错误:'Ch ...
- Asp.Net MVC<一> : 三层架构、MVC
MVC.MVP.MVVM.Angular.js.Knockout.js.Backbone.js.React.js.Ember.js.Avalon.js.Vue.js 概念摘录 认清Android框架 ...
- Spring 在web 容器中的启动过程
1.对于一个web 应用,其部署在web 容器中,web 容器提供其一个全局的上下文环境,这个上下文就是 ServletContext ,其后面的spring IoC 容器提供宿主环境 2.在web. ...
- pycharm实用快捷键
提示 CTRL Q: 在参数列表位置,显示可以输入的所有参数. CTRL Q: 查看选中方法的文档字符串 阅读 CTRL -: 折叠当前代码 CTRL +: 展开当前代码 CTRL SHIFT -: ...
- iOS9 支持http
在Info.plist中添加NSAppTransportSecurity类型Dictionary. 在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型 ...