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 ...
随机推荐
- IOS学习笔记3—Objective C—简单的内存管理
今天简述一下简单的内存管理,在IOS5.0以后Apple增加了ARC机制(Automatic Reference Counting),给开发人员带来了不少的方便,但是为了能更好的理解IOS内存管理机制 ...
- vue 父子组件的加载顺序
一.加载渲染过程 父beforeCreate->父created->父beforeMount->子beforeCreate->子created->子beforeMount ...
- 【简●解】[SDOI2008] Sue的小球
[简●解][SDOI2008] Sue的小球 计划着刷\(DP\)题结果碰到了这样一道论文题,幸好不是太难. [题目大意] 口水话有点多,所以就直接放链接.传送门 [分析] 看到题首先联想到了曾经做过 ...
- CentOS 6及7 丢失root密码解决方案
6.x系列 法一:使用光盘镜像 BIOS中设置CD-ROM启动——选择救援模式——系统被自动挂载到/mnt/sysimage下——选择进入shell start shell——进入shell命令行—— ...
- (十九)python 3 内嵌函数和闭包
内嵌函数:函数里又嵌套一个函数 def fun1(): print('fun1()在被调用') def fun2(): print('fun2()在被调用') fun2() 闭包: 闭包是函数里面嵌套 ...
- 痛苦的版本对齐(3) cygwin下的路径引用(sed解决篇)
上次问题(见http://www.cnblogs.com/yvivid/p/3546649.html),.depend信息路径错误的问题. 主要尝试了,在(虚拟机下构建)linux下编译,确实没有问题 ...
- 剑指Offer(书):打印从1到最大的n位数
题目:输入数字N,按顺序打印出从1到最大的N位十进制数,比如输入3,则打印出1.2.3一直到999 分析:N的范围不定.所以有可能超出范围,因此用数组存放以及输出.说实话,对复杂递归还是一头雾水 pu ...
- CentOS 6.5 x64 安装jdk8
1.去官网下载Linux版本的jdk8,我下载的是下面这个 2.下载xftp和xshell来操纵服务器,可以搜索一下下载安装即可,安装完成后,打开xshell,新建链接为你的云服务器的IP地址和密码, ...
- P1880 NOIP 1995石子合并
复习(du) 这道题,发现思想真不错 当时背板子打下来的 要下晚自习了,明天更注释吧 #include<iostream> #include<queue> #include&l ...
- 大数据学习——hadoop的RPC框架
项目结构 服务端代码 test-hadoop-rpc pom.xml <?xml version="1.0" encoding="UTF-8"?> ...