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 ...
随机推荐
- 【面试 SQL】【第十六篇】SQL相关面试
=================================================================================== 1.一张表,姓名,科目,成绩,一 ...
- nssm和AlwaysUp来包装exe文件为windows服务
最近遇到要把windows exe文件部署为service,因为原先开发为exe程序,现在有不想修改code改为service,但是部署必须是service服务, 所以我们需要一个包装器来包装exe为 ...
- Android典型界面设计(8) ——ViewPager+PagerSlidingTabStrip实现双导航
一.问题描述 PagerSlidingTabStrip是android开源项目,指示器控件.官网地址:https://github.com/astuetz/PagerSlidingTabStrip 该 ...
- Nginx代理proxy pass配置去除前缀
使用Nginx做代理的时候,可以简单的直接把请求原封不动的转发给下一个服务. 比如,访问abc.com/appv2/a/b.html, 要求转发到localhost:8088/appv2/a/b.ht ...
- 屌丝也用按位与(&),按位或(|) (二)
上篇讲到了,用按位操作进行配置,下边来讲一个大神也在用的例子 linux的权限系统 我们知道一个文件,如果是777,那么是最高的权限,那这个七是咋构成的,我会告诉你是 4+2+1么? 我会告诉你,是1 ...
- SQL Server为字段添加默认值
SQL Server为字段添加默认值 if not exists ( select * from sys.columns as c join sys.objects as o on c.default ...
- JAVA常用代码
一. 判断是否包含某个注解. 1). 声明接口 @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Documented ...
- 简单shell指令
第一部分 简单的常用指令 1.date命令 date 2.显示日历 cal 3.显示当前目录 pwd 4.切换当前工作目录 默认情况下,超级用户的主目录是/root,而普通用户的主目录是/home下 ...
- php write_ini_file
php读ini文件有很方便的pares_ini_file,但是写回去却没有,这里写一个: function write_ini_file($assoc_arr, $path, $has_section ...
- mysql 物理数据存放
报错误:1030 - Got error 28 from storage engine 3.在系统中查看/tmp是否已经满了: [root@localhost /]# df /tmp/ Filesys ...