/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 相关文章推荐
PHP 应用程序的安全 -- 不能违反的四条安全规则
Nov 26 PHP
Windows下安装Memcached的步骤说明
Apr 25 PHP
php中批量替换文件名的实现代码
Jul 20 PHP
JS异常处理try..catch语句的作用和实例
May 05 PHP
php发送html格式文本邮件的方法
Jun 10 PHP
php链表用法实例分析
Jul 09 PHP
php模板引擎技术简单实现
Mar 15 PHP
PHP经典算法集锦【经典收藏】
Sep 14 PHP
php把时间戳转换成多少时间之前函数的实例
Nov 16 PHP
php接口技术实例详解
Dec 07 PHP
THINKPHP截取中文字符串函数实例代码
Mar 20 PHP
thinkPHP框架实现的简单计算器示例
Dec 07 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
极典R601SW收音机
2021/03/02 无线电
php 无限级分类学习参考之对ecshop无限级分类的解析 带详细注释
2010/03/23 PHP
PHP扩展程序实现守护进程
2015/04/16 PHP
PHP实现通过get方式识别用户发送邮件的方法
2015/07/16 PHP
PHP判断JSON对象是否存在的方法(推荐)
2016/07/06 PHP
执行iframe中的javascript方法
2008/10/07 Javascript
JS 获取浏览器和屏幕宽高等信息的实现思路及代码
2013/07/31 Javascript
将list转换为json失败的原因
2013/12/17 Javascript
2014 HTML5/CSS3热门动画特效TOP10
2014/12/07 Javascript
基于javascript、ajax、memcache和PHP实现的简易在线聊天室
2015/02/03 Javascript
JavaScript实现定时隐藏与显示图片的方法
2015/08/06 Javascript
Javascript对象字面量的理解
2016/06/22 Javascript
javascript 显示全局变量与隐式全局变量的区别
2017/02/09 Javascript
Node.js 实现远程桌面监控的方法步骤
2019/07/02 Javascript
angular8和ngrx8结合使用的步骤介绍
2019/12/01 Javascript
Node.js API详解之 os模块用法实例分析
2020/05/06 Javascript
js+cavans实现图片滑块验证
2020/09/29 Javascript
[00:30]塑造者的传承礼包-戴泽“暗影之焰”套装展示视频
2014/04/04 DOTA
pyv8学习python和javascript变量进行交互
2013/12/04 Python
初步认识Python中的列表与位运算符
2015/10/12 Python
Python中字符串的常见操作技巧总结
2016/07/28 Python
centos6.8安装python3.7无法import _ssl的解决方法
2018/09/17 Python
python获取本周、上周、本月、上月及本季的时间代码实例
2020/09/08 Python
Python SMTP发送电子邮件的示例
2020/09/23 Python
Python抖音快手代码舞(字符舞)的实现方法
2021/02/07 Python
Python使用cn2an实现中文数字与阿拉伯数字的相互转换
2021/03/02 Python
设计师家具购买和委托在线市场:Viyet
2016/11/16 全球购物
迪卡侬印尼体育用品商店:Decathlon印尼
2020/03/11 全球购物
小学教师培训感言
2014/02/11 职场文书
学校教研活动总结
2014/07/02 职场文书
2014年公务员退休工资改革方案
2014/10/01 职场文书
2014年音乐教师工作总结
2014/12/03 职场文书
入党介绍人意见2015
2015/06/01 职场文书
2016年小学生新年寄语
2015/08/18 职场文书
2019财务毕业实习报告
2019/06/27 职场文书
互联网的下一个风口:新的独角兽将诞生
2019/08/02 职场文书