/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代码
Feb 16 PHP
php将fileterms函数返回的结果变成可读的形式
Apr 21 PHP
如何使用Linux的Crontab定时执行PHP脚本的方法
Dec 19 PHP
如何用php获取文件名后缀
Jun 09 PHP
根据ip调用新浪api获取城市名并转成拼音
Mar 07 PHP
微信营销平台系统?刮刮乐的开发
Jun 10 PHP
PHP中加密解密函数与DES加密解密实例
Oct 17 PHP
thinkphp浏览历史功能实现方法
Oct 29 PHP
Linux系统递归生成目录中文件的md5的方法
Jun 29 PHP
CI框架常用方法小结
May 17 PHP
Yii2中hasOne、hasMany及多对多关联查询的用法详解
Feb 15 PHP
PHP读取文件或采集时解决中文乱码
Mar 09 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 cookie与session会话基本用法实例分析
2019/11/18 PHP
基于jquery的finkyUI插件与Ajax实现页面数据加载功能
2010/12/03 Javascript
广泛收集的jQuery拖放插件集合
2012/04/09 Javascript
JavaScript prototype 使用介绍
2013/08/29 Javascript
原生js制作日历控件实例分享
2016/04/06 Javascript
JavaScript数据结构链表知识详解
2016/11/21 Javascript
angularjs指令之绑定策略(@、=、&)
2017/04/13 Javascript
angular-cli修改端口号【angular2】
2017/04/19 Javascript
Js on及addEventListener原理用法区别解析
2020/07/11 Javascript
js实现全选和全不选
2020/07/28 Javascript
Python自动生产表情包
2017/03/17 Python
django rest framework 数据的查找、过滤、排序的示例
2018/06/25 Python
python+pandas+时间、日期以及时间序列处理方法
2018/07/10 Python
django之状态保持-使用redis存储session的例子
2019/07/28 Python
Python使用pymysql模块操作mysql增删改查实例分析
2019/12/19 Python
python接口自动化如何封装获取常量的类
2019/12/24 Python
Python Websocket服务端通信的使用示例
2020/02/25 Python
部署Django到阿里云服务器教程示例
2020/06/03 Python
Python3爬虫mitmproxy的安装步骤
2020/07/29 Python
使用canvas一步步实现图片打码功能的方法
2019/06/17 HTML / CSS
Space NK英国站:英国热门美妆网站
2017/12/11 全球购物
SHEIN台湾:购买最新流行女装服饰
2019/05/18 全球购物
澳大利亚儿童精品仓库:Goo & Co.
2019/06/20 全球购物
越南母婴用品购物网站:Kids Plaza
2020/04/09 全球购物
什么是网络协议
2016/04/07 面试题
Python面试题:Python里面如何生成随机数
2015/03/12 面试题
如何用Java判断一个文件或目录是否存在
2012/11/19 面试题
料理师求职信
2014/01/30 职场文书
优秀教师获奖感言
2014/01/31 职场文书
庆祝教师节活动方案
2014/01/31 职场文书
化学教学随笔感言
2014/02/19 职场文书
网络管理员岗位职责
2014/03/17 职场文书
小学四年级学生评语
2014/12/26 职场文书
golang中字符串MD5生成方式总结
2021/07/04 Golang
springboot+WebMagic+MyBatis爬虫框架的使用
2021/08/07 Java/Android
Python实现学生管理系统并生成exe可执行文件详解流程
2022/01/22 Python