nginx File not found 错误(转)
当我没初始配在lnmp的时候,用浏览器打开查看php能否解析网页的时出现File not found 不用惊奇让我我们分析一下
使用php-fpm解析PHP,"No input file specified","File not found"是令nginx新手头疼的常见错误,原因是php-fpm进程找不到SCRIPT_FILENAME配置的要执行的.php文件,php-fpm返回给nginx的默认404错误提示。
一、错误的路径被发送到php-fpm进程
出现这类错误,十个有九个是后端fastcgi进程收到错误路径(SCRIPT_FILENAME),而后端fastcgi收到错误路径的原因大都是配置错误。
常见的nginx.conf的配置如下:
user www www;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/nginx/html; #指定索引文件的目录
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ { #开启php解析
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME script$fastcgi_script_name
改为:
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; #指定路径
include fastcgi_params;
}
# fastcgi_params;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
然后在重启nginx,打开浏览器查看php是否能解析网页!
转载于:https://www.cnblogs.com/qq78292959/p/4034310.html
nginx File not found 错误(转)相关推荐
- nginx file not found 错误处理小记
2019独角兽企业重金招聘Python工程师标准>>> 安装完php php-fpm nginx 后访问php出现file not found错误,html就没问题配置文件serve ...
- nginx File not found 错误(Nginx无法解析PHP文件)
当我没初始配在lnmp的时候,用浏览器打开查看php能否解析网页的时出现File not found 不用惊奇让我我们分析一下 使用php-fpm解析PHP,"No input file s ...
- Nginx的File not found 错误解决
本人的系统是 Debian7.0 64位 所用的Nginx是1.2.1 以下是某牛的研究,感谢. ×××××××××××××××××× 使用php-fpm解析PHP,"No input fi ...
- nginx openresty content_by_lua_file 404错误
nginx openresty content_by_lua_file 404错误 2018/08/05 19:18:59 [error] 21231#0: *63 failed to load ex ...
- NGINX访问日志和错误日志
Logs are very useful to monitor activities of any application apart from providing you with valuable ...
- (转)解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误
重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr ...
- 使用 EasyBCD 安装Ubuntu 14.04 Error 15: file not found错误的解决方法
使用 EasyBCD 安装Ubuntu 14.04 Error 15: file not found错误的解决方法 参考文章: (1)使用 EasyBCD 安装Ubuntu 14.04 Error 1 ...
- mkdir()提示No such file or directory错误的解决方法
mkdir()提示No such file or directory错误的解决方法 参考文章: (1)mkdir()提示No such file or directory错误的解决方法 (2)http ...
- 编译驱动时出现Cannot open file trace.h错误
编译驱动时出现"Cannot open file trace.h"错误 如题,用VS2013编译驱动是出现上述错误,原来是开启了WPP追踪导致的: 解决方案: 右键项目名-属性-W ...
最新文章
- python魔术方法call_php魔术方法__call
- Singleton模式
- 程序员面试什么最重要
- mysql 开启断线重连_[BUG反馈]MYSQL长连接中(SWOOLE) 使用事务提交开启断线重连接抛出异常...
- RANSAC算法做直线拟合
- Winform中实现ZedGraph的多条Y轴(附源码下载)
- 【数据分析】八种缺失值处理方法总有一种适合你
- 3线程的终止方式,线程属性,NPTL
- iOS-UICollectionView快速构造/拖拽重排/轮播实现
- Linux C语言解析 yaml,c – 用yaml cpp解析yaml
- TensorFlow 的简化接口Scikit Flow
- VOS防止盗打及后门的安全策略
- java打印sscil码_SSCI期刊投稿指南库
- vue多级菜单的实现
- 华为技术官又出神作,鸿蒙操作系统完整文档笔记现已疯传
- Android开发各版本适配(不断更新)
- setHeader方法的参数说明
- 云原生分布式 PostgreSQL+Citus 集群在 Sentry 后端的实践
- Python爬取了猫眼47858万条评论,告诉你《飞驰人生》值不值得看?!
- 强行重置Mac OS X管理员密码
热门文章
- 在UE4中创建受《羞辱》启发的环境
- python实现基于八方向判断的断裂连接
- 控制文件中的 MAXDATAFILES 参数
- SPOJ.TLE - Time Limit Exceeded(DP 高维前缀和)
- 一个简单的案例带你入门Dubbo分布式框架
- Java Script 学习笔记(一)
- openquery基本运用实例
- Java:数列排序 给定一个长度为n的数列,将这个数列按从小到大的顺序排列。1<=n<=200
- python pygame模块按键延迟_pygame模块中键控命令不能实现方块移动,求解
- 中切片工具怎么使用_PS软件中钢笔工具的使用,附视频