/etc/php-fpm.d/www.conf 配置注意事项


Posted in PHP onFebruary 04, 2017

1、php-fpm 配置文件里 rlimit_files的值 要与系统的打开连接数一致

1)查看系统文件打开连接数

[root@iZ94eveq0q4Z ~]# ulimit -n
65535

2)查看一下php-fpm 配置文件里 rlimit_files的值

; Set open file descriptor rlimit#rlimit设置打开的文件描述符
; Default Value: system defined value
rlimit_files = 65535
如果两个值不一样,则要设置为一样

方法如下:

3)设置系统打开文件连接数

[root@hotdata ~]# ulimit -HSn 65535
[root@hotdata ~]# ulimit -n
65535
[root@hotdata ~]#

设置好后重启php-fpm服务

2、 request_terminate_timeout = 0 设置为0

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the ‘max_execution_time' ini option
; does not stop script execution for some reason. A value of '0′ means ‘off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_terminate_timeout = 0

因为这个参数会直接杀掉php进程,然后重启php进程,这样前端nginx就会返回104: Connection reset by peer。这个过程是很慢,总体感觉就是网站很卡

nginx可能出现502
recv() failed (104: Connection reset by peer) while reading response header from upstream

3、request_slowlog_timeout这个配置不要开启

之前服务器上开始了这个参数,并且设置如下:

request_slowlog_timeout = 10导致图片处理每次都失败,每次都是502错误。

错误信息如下:

Nginx的错误信息:
2015/12/28 16:20:23 [error] 649#0: *9862 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 163.177.69.13,

php-fpm的错误信息为:

[28-Dec-2015 17:04:01] WARNING: [pool www] child 10520, script '/hotdata/kehu/foshang_niufeecms/index.php' (request: "GET /index.php") execution timed out (10.451550 sec), terminating
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10512, script '/hotdata/kehu/foshang_niufeecms/index.php' (request: "GET /index.php") execution timed out (12.396650 sec), terminating
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10520 exited on signal 15 (SIGTERM) after 73.413706 seconds from start
[28-Dec-2015 17:04:01] NOTICE: [pool www] child 10909 started
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10512 exited on signal 15 (SIGTERM) after 73.421170 seconds from start
[28-Dec-2015 17:04:01] NOTICE: [pool www] child 10910 started/var/log/php-fpm/www-slow.log记录如下

[28-Dec-2015 16:23:17]  [pool www] pid 2427
script_filename = /hotdata/kehu/foshang_niufeecms/index.php
[0x00007f94070ff668] file_get_contents() /hotdata/kehu/foshang_niufeecms/index/Lib/Action/MemberAction.class.php:516
[0x00007f94070ff140] makecar() /hotdata/kehu/foshang_niufeecms/index/Lib/Action/MemberAction.class.php:623
[0x00007fff6b5bd870] ajaxMakeCart() unknown:0
[0x00007f94070fde48] invoke() /hotdata/kehu/foshang_niufeecms/core/Lib/Core/App.class.php:171
[0x00007f94070fdc70] exec() /hotdata/kehu/foshang_niufeecms/core/Lib/Core/App.class.php:207
[0x00007f94070fda98] run() /hotdata/kehu/foshang_niufeecms/core/Lib/Core/Think.class.php:39
[0x00007f94070fc610] start() /hotdata/kehu/foshang_niufeecms/core/Common/runtime.php:242
[0x00007f94070fbef8] +++ dump failed

所以最好是要这个设置给屏蔽掉。
;request_slowlog_timeout = 10

以上这篇/etc/php-fpm.d/www.conf 配置注意事项就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

PHP 相关文章推荐
用cookies来跟踪识别用户
Oct 09 PHP
PHP脚本的10个技巧(2)
Oct 09 PHP
我的论坛源代码(九)
Oct 09 PHP
centos 5.6 升级php到5.3的方法
May 14 PHP
php时间戳转换的示例
Mar 31 PHP
PHP捕获Fatal error错误的方法
Jun 11 PHP
跟我学Laravel之请求(Request)的生命周期
Oct 15 PHP
php微信开发之批量生成带参数的二维码
Jun 26 PHP
微信支付开发订单查询实例
Jul 12 PHP
PHP+Apache环境中如何隐藏Apache版本
Nov 24 PHP
PHP压缩图片功能的介绍
Mar 21 PHP
PHP类的自动加载与命名空间用法实例分析
Jun 05 PHP
PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析
Feb 04 #PHP
Yii2实现多域名跨域同步登录退出
Feb 04 #PHP
PHP使用mysqli操作MySQL数据库的简单方法
Feb 04 #PHP
PHP使用preg_split()分割特殊字符(元字符等)的方法分析
Feb 04 #PHP
用PHP的socket实现客户端到服务端的通信实例详解
Feb 04 #PHP
关于PHP内置的字符串处理函数详解
Feb 04 #PHP
详谈PHP面向对象中常用的关键字和魔术方法
Feb 04 #PHP
You might like
php中heredoc与nowdoc介绍
2014/12/25 PHP
php面向对象中static静态属性与方法的内存位置分析
2015/02/08 PHP
PHP中字符安全过滤函数使用小结
2015/02/25 PHP
Redis构建分布式锁
2017/03/28 PHP
使用php自动备份数据库表的实现方法
2017/07/28 PHP
cnblogs TagCloud基于jquery的实现代码
2010/06/11 Javascript
JavaScript 拾碎[三] 使用className属性
2010/10/16 Javascript
js中运算符&& 和 || 的使用记录
2014/08/21 Javascript
JS组件Bootstrap Table使用方法详解
2016/02/02 Javascript
jQuery 如何给Carousel插件添加新的功能
2016/04/18 Javascript
JavaScript正则表达式实例详解
2016/10/16 Javascript
jquery dataview数据视图插件使用方法
2016/12/23 Javascript
ES6概念 Symbol.keyFor()方法
2016/12/25 Javascript
浅谈regExp的test方法取得的值变化的原因及处理方法
2017/03/01 Javascript
AngularJS+Bootstrap3多级导航菜单的实现代码
2017/08/16 Javascript
vue中如何使用ztree
2018/02/06 Javascript
Vuex 在Vue 组件中获得Vuex 状态state的方法
2018/08/27 Javascript
聊聊Vue 中 title 的动态修改问题
2019/06/11 Javascript
ES6 Array常用扩展的应用实例分析
2019/06/26 Javascript
KnockoutJS数组比较算法实例详解
2019/11/25 Javascript
基于Python os模块常用命令介绍
2017/11/03 Python
浅谈Django REST Framework限速
2017/12/12 Python
修复CentOS7升级Python到3.6版本后yum不能正确使用的解决方法
2018/01/26 Python
Numpy数据类型转换astype,dtype的方法
2018/06/09 Python
Django异步任务之Celery的基本使用
2019/03/23 Python
Python3.5常见内置方法参数用法实例详解
2019/04/29 Python
python 协程 gevent原理与用法分析
2019/11/22 Python
Python内置加密模块用法解析
2019/11/25 Python
python两种获取剪贴板内容的方法
2020/11/06 Python
使用JS+CSS3技术:让你的名字动起来
2013/04/27 HTML / CSS
阿提哈德航空官方网站:Etihad Airways
2017/01/06 全球购物
大四自我鉴定范文
2013/10/06 职场文书
kfc实习自我鉴定
2013/12/14 职场文书
个人租房协议书(范本)
2014/10/14 职场文书
幼师大班个人总结
2015/02/13 职场文书
记者节感言
2015/08/03 职场文书