今天在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害慘了的更多相关文章

  1. CentOS 7运维管理笔记(12)----PHP页面失去焦点后变成空白的解决方法

    昨天搭建好了LAMP服务器,可以正常看到PHP页面了.后来发现每当把鼠标从浏览器中移开而点击其他地方时,PHP页面就变成一片空白.即PHP页面失去焦点后就变空白,不知为何. 今天网上搜索解决方案,终于 ...

  2. Nginx 訪问日志增长暴增出现尖刀的具体分析

    前言:          Nginx日志里面Mobileweb_access.log增长特别大.一天上百兆.将近100W的訪问记录.依照我们眼下的规模,热点用户才500个左右.就算人人用手机app訪问 ...

  3. CentOS 配置httpd使局域网能够正常訪问

    [转载请注明出处: 钱国正的专栏http://blog.csdn.net/qianguozheng/article/details/37611859] 问题: 在CentOS上安装apache,配置好 ...

  4. Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)

    Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建) 具体案例:局域网内有两台主机,一台Linux.一台Windows,现在需要配置一台Cacti监控服务器对这两台 ...

  5. [Nginx] - PHP+FPM相关的配置

    CodeIgniter的配置: worker_processes ; events { worker_connections ; } http { include mime.types; defaul ...

  6. CentOS+Nginx+PHP 前端部署

    都说Nginx比Apache性能优越,一直没有时间装测试,今天终于有时间装上试试性能了,其实Nginx的安装非常简单,具体流水步骤记录如下: 1.系统环境: ===================== ...

  7. 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 的安 ...

  8. CentOS + Nginx 的常用操作指令总结

    CentOS + Nginx 的常用操作指令总结 一. 关于CentOS 查看 yum 源是否存在 yum list | grep nginx 如果不存在 或者 不是自己想要的版本 可以自己设置Ngi ...

  9. CentOS+Nginx+PHP+MySQL详细配置(图解)

    原文地址: http://www.jb51.net/article/26597.htm CentOS+Nginx+PHP+MySQL详细配置(带有图解),需要的朋友可以参考下.   一.安装MySQL ...

随机推荐

  1. C++中static,extern和extern "C"关键字

    1. extern 变量 extern 表明该变量在别的地方已经定义过了,在这里要使用那个变量. 当extern不与"C"在一起修饰变量或函数时,如在头文件中: extern in ...

  2. tabs标签页的数据缓存

    一进入tabs标签页默认就将所有标签页的数据请求到,并渲染到页面上, 这样如果数据量太大的话会渲染很久, 我的需求就是点击不同的标签时再请求数据,同时对点击过的标签页数据进行缓存,下次点击时不再重新请 ...

  3. Manjaro安装SS客户端

    首先安装shadowsocks-libev sudo pacman -S shadowsocks-libev 然后编辑配置文件 vim /etc/shadowsocks/config.json { & ...

  4. img元素srcset属性浅析

    img srcset 属性 img 元素的 srcset 属性用于浏览器根据宽.高和像素密度来加载相应的图片资源. 属性格式:图片地址 宽度描述w 像素密度描述x,多个资源之间用逗号分隔.例如: &l ...

  5. day17-python之文件操作

    1.内置函数 #!/usr/bin/env python # -*- coding:utf-8 -*- # print(abs(-1)) # print(abs(1)) # # print(all([ ...

  6. 查看linux ubuntu版本

    ubuntu版本: lsb_release -a  linux版本: uname -a proc目录下记录的当前系统运行的各种数据,version记录的版本信息直接可以通过cat查看到. 使用命令:c ...

  7. Python工程师面试题目

    1.请尽可能列举python列表的成员方法,并给出一下列表操作的答案: len() 返回列表中的元素数量. max() 返回列表中的最大元素.最大元素的判断依据是列表中的对象类型.数字列表中的最大元素 ...

  8. Codeforces 892 D.Gluttony

    D. Gluttony time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...

  9. .NET 调用java webservice保存datetime类型数据为空的解决办法

    问题描述:       用C#.NET调用Java开发的WebService时,先在客户端封装的带有int属性的对象,当将该对象传到服务器端时,服务器端可以得到 string类型的属性值,却不能得到i ...

  10. 《TCP/IP详解卷1:协议》——第3章 IP:网际协议(转载)

    1.引言 IP是TCP/IP协议族中最核心的协议.所有的TCP.UDP.ICMP及IGMP数据都以IP数据报格式传输.IP提供不可靠. 无连接的数据报传送服务. (1)不可靠 它不能保证IP数据报能成 ...