centos+nginx+php-fpm+php include fastcgi_params php页面能訪问但空白,被fastcgi_params与fastcgi.conf害慘了
今天在centos上折腾这块是发现老是訪问页面时,浏览器中提示是200 ok.且訪问html后缀却是正常出现内容.
可是訪问php后缀却返回空白页面,同一时候查看全部的log没有发现不论什么出错信息;
再在nginx.conf中的server中写假设 路径不存在就return 405这种断句来调试,发现我的配置还是正常能走到那个405.
就是没有内容返回....
找了几个小时.头都快晕了.
还是没有搞明确怎么回事.
最后想想和比較了下fastcgi_params与fastcgi.conf,头已经晕了,看了几眼,没看出区别来了.
我包括的是params这个文件,不是conf这个.我就郁闷死了...怎么回事?
然后想想.是不是试试饮食一下conf这个试试看?
一改变.刷新页面,居然出来内容了...
再回头细致看眼二个文件.居然还是没发现有什么差别....已经所有晕了.
使用二个文件名称在网上查找一下,才发现,这二个文件真有差别;
并且另一个历史.
FASTCGI_PARAMS VERSUS FASTCGI.CONF – NGINX CONFIG HISTORY
Tweet
The nginx source install (and by extension package managers) includes two FastCGI configuration files, fastcgi_params and fastcgi.conf that differ only a tiny bit. To this day they still cause confusion amongst new users due to package managers. The difference between the two files in the source install is the simple line of: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
The difference between the two files in most distributions package repositories is nothing, they essentially modified fastcgi_params to match fastcgi.conf. What this line does is tell PHP which file it should execute, without this nginx and PHP cannot work together. This sounds like a good line to include in the shipped FastCGI configuration file and indeed Igor Sysoev thought so as well. However, due to the configurations of the time this wasn’t as easy as simply adding it in. Back in the days of 0.6.x when I started using nginx and a few years before this change happened a typical configuration example would look like this. location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/foo$fastcgi_script_name;
fastcgi_pass backend;
}
Due to community documentation efforts on the wiki people slowly started using the $document_root variable instead of hard coding the root path, however, many people were still using the above configuration many years later. Because of how array directives inherit and interact the people using the old configuration style made it impossible to include the line in fastcgi_params. Doing this would have meant that SCRIPT_FILENAME would be defined twice and both would be sent to the backend, potentially causing confusing behaviour. In 0.8.30 (released: 15th of December 2009) Igor then included fastcgi.conf which was the same as fastcgi_params except including the improved SCRIPT_FILENAME fastcgi_param. This meant that the community could now start recommending people include fastcgi.conf instead of recommending moving SCRIPT_FILENAME into fastcgi_params. New articles on the wiki mostly used this, the popular articles were slowly changed to use it and we were promoting it in the IRC support channel. Of course, an issue back then was that package managers gave nginx very little love and were many versions behind, usually something like 0.6.x versus 0.8.x. The fastcgi.conf file was not included for these people. When they eventually did update they shipped with a fastcgi.conf and a modified fastcgi_params leaving us with a situation where the source install actually differed from the repository install in a non-significant way. While not often, this does still cause the occasional confusing in the IRC channel. As an aside, I actually prefer fastcgi_param SCRIPT_FILENAME $request_filename;
as it takes the alias directive into account, fastcgi_new.conf anyone? Last updated:Sunday, July 7, 2013
关于上面的说法我理解是:
非常久非常久曾经,大家都是include fastcgi_params,并且在后面加上一句
fastcgi_param SCRIPT_FILENAME /var/www/foo$fastcgi_script_name;
由于这个指令它是数组形态的,并不会说,同名的指令,后面会替换掉前面的.
而nginx的开发人员慢慢发现大家写死这个root有问题.或是不方便?
于是给了一个方案,或是说,前面的时候,那块还不能写变量?
里面是硬编码写死的?
后面能够了.可是预计非常多人还是旧写法,假设直接把这句增加params这个文件的前面话,就会可能跟nginx.conf中同一时候出现,了二次.就会导致非常多莫名的问题,
有可能某些地方会用前面一个指令的路径,而还有一个地方会可能用到后面一个指令.
所以,作者保留params,新加一个文件叫fastcgi.conf.
而我却刚好理解成这二个文件是同样的...可是由于没有提供这个指令,所以,导致没有文件发送到php gate中.那么.就返回了空白内容;;;;;;;
我晕死了....几个小时........一段历史......假设在fastcgi.conf上加几下凝视说明,让粗心,没有细致看的我就不会这么慘了....
centos+nginx+php-fpm+php include fastcgi_params php页面能訪问但空白,被fastcgi_params与fastcgi.conf害慘了的更多相关文章
- CentOS 7运维管理笔记(12)----PHP页面失去焦点后变成空白的解决方法
昨天搭建好了LAMP服务器,可以正常看到PHP页面了.后来发现每当把鼠标从浏览器中移开而点击其他地方时,PHP页面就变成一片空白.即PHP页面失去焦点后就变空白,不知为何. 今天网上搜索解决方案,终于 ...
- Nginx 訪问日志增长暴增出现尖刀的具体分析
前言: Nginx日志里面Mobileweb_access.log增长特别大.一天上百兆.将近100W的訪问记录.依照我们眼下的规模,热点用户才500个左右.就算人人用手机app訪问 ...
- CentOS 配置httpd使局域网能够正常訪问
[转载请注明出处: 钱国正的专栏http://blog.csdn.net/qianguozheng/article/details/37611859] 问题: 在CentOS上安装apache,配置好 ...
- Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)
Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建) 具体案例:局域网内有两台主机,一台Linux.一台Windows,现在需要配置一台Cacti监控服务器对这两台 ...
- [Nginx] - PHP+FPM相关的配置
CodeIgniter的配置: worker_processes ; events { worker_connections ; } http { include mime.types; defaul ...
- CentOS+Nginx+PHP 前端部署
都说Nginx比Apache性能优越,一直没有时间装测试,今天终于有时间装上试试性能了,其实Nginx的安装非常简单,具体流水步骤记录如下: 1.系统环境: ===================== ...
- 1分钟完美安装最新CentOS+Nginx+PHP-FPM+MySQL
PHP 5.3.1 MySQL 5.0.89 Nginx 0.8.33 或 0.7.65 (可选) 现在,我们可以快速全自动搞定 CentOS + Nginx + PHP-FPM + MySQL 的安 ...
- CentOS + Nginx 的常用操作指令总结
CentOS + Nginx 的常用操作指令总结 一. 关于CentOS 查看 yum 源是否存在 yum list | grep nginx 如果不存在 或者 不是自己想要的版本 可以自己设置Ngi ...
- CentOS+Nginx+PHP+MySQL详细配置(图解)
原文地址: http://www.jb51.net/article/26597.htm CentOS+Nginx+PHP+MySQL详细配置(带有图解),需要的朋友可以参考下. 一.安装MySQL ...
随机推荐
- sleep 和wait的差别
基本的差别 1.sleep 是Thread 类的方法,wait 是Object类中定义的方法 2.sleep()方法可以在任何地方使用 3.wait()方法只能在synchronized方法中使用,或 ...
- 前端 (cookie )页面进入存储一次
<!--引入jq--> <script> var isShowTip = window.sessionStorage.getItem("isShow") ...
- POJ-2442-Sequence(二叉堆)
POJ-2442 Description Given m sequences, each contains n non-negative integer. Now we may select one ...
- mysql单实例多库与多实例单库
一.单实例多库: 一个mysql实例,创建多个数据目录. 规划: 实例路径:/usr/local/mysql 数据目录路径: (1)/usr/local/mysql/data (2)/usr/loca ...
- 10. GLOBAL_STATUS 与 SESSION_STATUS
10. GLOBAL_STATUS 与 SESSION_STATUS 注意 从MySQL 5.7.6开始,show_compatibility_56系统变量的值会影响此处描述的表中的可用信息. 有关详 ...
- 4. InnoDB表单独表空间
4. InnoDB表单独表空间 从历史上看,所有InnoDB表和索引都存储在系统表空间中.这种单片方法的目标是完全专用于数据库处理的机器,精心规划的数据增长,其中任何分配给MySQL的磁盘存储都不会用 ...
- linux系统日志中出现大量systemd Starting Session ### of user root 解决
这种情况是正常的,不算是一个问题 https://access.redhat.com/solutions/1564823 Environment Red Hat Enterprise Linux 7 ...
- 【BZOJ 2462】矩阵模板 (二维哈希)
题目 给定一个M行N列的01矩阵,以及Q个A行B列的01矩阵,你需要求出这Q个矩阵哪些在 原矩阵中出现过. 所谓01矩阵,就是矩阵中所有元素不是0就是1. 输入 输入文件的第一行为M.N.A.B,参见 ...
- 算法导论 第十二章 二叉搜索树(python)
上图: 这是二叉搜索树(也有说是查找树的)基本结构:如果y是x的左子树中的一个结点,那么y.key <= x.key(如a图中的6根结点大于它左子树的每一个结点 6 >= {2,5,5}) ...
- JSP配置即报错以及解决办法(未更新完)
JSP: JAVA Server Page 使用JAVA语言编写的一种在服务器运行的动态页面 JSP = JAVA + HTML JSP 的执行过程 1: 翻译阶段 把JSP源文件翻译成 java ...