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 ...
随机推荐
- win手动编译JAVA 未完成(系统path未加入文章)
java 下面存.BAT dir /s /B *.java > sources.txtjavac @sources.txt -bootclasspath "C:\Users\88797 ...
- android问题
http://www.cnblogs.com/tianjian/category/330793.html
- spring注解开发-扩展原理(源码)
1.BeanFactoryPostProcessor BeanPostProcessor:bean后置处理器,bean创建对象初始化前后进行拦截工作的; BeanFactoryPostProcesso ...
- 【2018 CCPC网络赛】1003 - 费马小定理
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6440 这题主要是理解题意: 题意:定义一个加法和乘法,使得 (m+n)p = mp+np; 其中给定 ...
- CF528D Fuzzy Search 字符串匹配+FFT
题意: DNA序列,在母串s中匹配模式串t,对于s中每个位置i,只要s[i-k]到s[i+k]中有c就认为匹配了c.求有多少个位置匹配了t. 分析: 这个字符串匹配的方式,什么kmp,各种自动机都不灵 ...
- Linux CentOS 知识和常用命令
1.常用热键 [Tab]它具有“命令补全”与“文件补全”的功能[Ctrl+C]中断执行中的程序组合键[Ctrl+d]键盘输入结束.也可以用来替代 exit 2.Linux 常用编辑器 vi 和 vim ...
- Jvm:性能调优监控工具
现实企业级Java开发中,有时候我们会碰到下面这些问题: OutOfMemoryError,内存不足 内存泄露 线程死锁 锁争用(Lock Contention) Java进程消耗CPU过高 .... ...
- laravel 集成 swagger插件
原文链接:https://medium.com/@mahbubkabir/discovering-swagger-in-laravel-rest-apis-cb0271c8f2 1.composer ...
- Python中的函数(5)
一.向函数中传递任意数量的实参 有时候,你预先不知道函数需要接受多少个实参,Python中函数可以收集任意数量的实参. 栗子:来看一个打印好友列表功能的函数,它需要接收任意数量的好友名.如下: def ...
- 阿里云服务器ecs配置之安装mysql
安装mysql数据库 1.安装工作: 下载 mysql 源安装包 [root@ming ~]# wget http://dev.mysql.com/get/ ...