File not found 错误 nginx
这个错误很常见,很明显找不到文件。
原因是php-fpm找不到SCRIPT_FILENAME里执行的php文件,所以返回给nginx 404 错误。
那么两种情况要么文件真的不存在,要么就是路径错误。
location / {
root /var/www/example.com;
index index.html index.htm index.pl;
}
如果配置文件这样的,那么明显不好,也就是在
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME #document_root$fastcgi_script_name;
include fastcgi_params;
}
这里的document就找不到document_root,所以可以把root放在location外面试试看或者在
location ~ \.php$ {}
里面加上root.
如果文件真的不存在的话,因为nginx检查$uri是不是.php结尾,不检查是不是存在,所以找不到时候就返回404错误。“No input file specified”
如果是这样的话,在配置文件种用try_files就可以检查是否存在了。
不存在就返回404.
location ~ .php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
...
}
File not found 错误 nginx的更多相关文章
- nginx file not found 错误处理小记
安装完php php-fpm nginx 后访问php出现file not found错误,html就没问题配置文件server 段如下 server { listen 80; server_name ...
- nginx运行出现 file not found 错误处理原因
在阿里云装nginx+php+mysql nginx运行出现 file not found 错误处理原因 1,第一情况 location ~ \.php$ { # root html; fastcgi ...
- 新装NGINX重启,出现错误 nginx: [error] open() "/usr/local/nginx/logs/nginx.pid"
重装nginx出现,重启出现错误 ./nginx -s reload nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" ...
- 编译驱动时出现"Cannot open file trace.h"错误
编译驱动时出现"Cannot open file trace.h"错误 如题,用VS2013编译驱动是出现上述错误,原来是开启了WPP追踪导致的: 解决方案: 右键项目名-属性-W ...
- /etc/rc.d/init.d/iptables: No such file or directory 错误原因
注:本文转载自cnblogs:一天学点的文章</etc/rc.d/init.d/iptables: No such file or directory 错误原因> RedHat Enter ...
- php的mysqli_connect函数显示 No such file or directory错误以及localhost换成127.0.0.1执行成功
Centos7环境-php7-MariaDB5.5.60 (新安装的php7,执行php -m 显示有mysqli模块,php.ini没有改其它) 测试代码为: <?php //~ echo d ...
- UI进阶 XML解析适配 'libxml/tree.h'file not found 错误解决办法
Xcode 'libxml/tree.h'file not found 错误解决办法
- mkdir()提示No such file or directory错误的解决方法
转自:http://www.02405.com/program/php/1692.html 在php中使用mkdir()方法创建文件夹时报错:No such file or directory,出错代 ...
- Linux运行shell脚本提示No such file or directory错误的解决办法
Linux执行.sh文件,提示No such file or directory的问题: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No s ...
随机推荐
- 怎样使用ZOL一键安装器下载中关村在线的源安装包
怎样使用ZOL一键安装器下载中关村在线的源安装包 马根峰 (广东联合电子服务股份有限公司, 广州 510300) 摘要 中关村在线近期開始推出ZOL一键安装器,用户直 ...
- Duplicate复制数据库并创建物理StandBy(pfile版本)
1设定环境如下: Primary数据库 IP 172.17.22.16 SID orcl Standby数据库 IP 172.17.22.17 SID orcl 设置提示,以区分操作的位置 prima ...
- python3下载图片
import urllib.request import socket import re import sys import os targetDir = r"E:\\DATA\常用py脚 ...
- vbox磁盘空间如何扩容
vbox磁盘空间如何扩容 为虚拟机硬盘扩容(Oracle VM VirtualBox) VBoxManage modifyhd <uuid>|<filename& ...
- android中webView加载H5,JS不能调用问题的解决
使用了html5 页面,使用webView加载后发现 超链接的锚点不可以用 为webView设置下面两句就好了: mWebView.getSettings().setDomStorageEnabled ...
- spring boot+ Intellj idea devtools 设置热部署
POM文件 <!--添加依赖--> <dependency> <groupId>org.springframework.boot</groupId> & ...
- struts2:多业务方法的处理(动态调用,DMI)
struts2支持调用指定Action类中某一个业务方法.如果没有指定,则调用execute方法. 1. 第一种实现方式,通过URL叹号参数 1.1 创建Action类,带多个方法 package c ...
- django 返回 code 405
return HttpResponse('Invalid Method',status=405)
- java中自定义注释@interface的用法
一.什么是注释 说起注释,得先提一提什么是元数据(metadata).所谓元数据就是数据的数据.也就是说,元数据是描述数据的.就象数据表中的字段一样,每个字段描述了这个字段下的数据的含义.而J ...
- PSR PHP业界规范
0x0 大型项目的问题 随着项目越来越大,参与的人数越来越多,代码变得越来越不可维护了. 每个人都给项目带来自己的风格,所以这时就需要大家采用一个统一的标准. 0x1 解决办法 于是顶尖的PHPer们 ...