/etc/php-fpm.d/www.conf 配置注意事项
1、php-fpm配置文件里rlimit_files的值要与系统的打开连接数一致
1)查看系统文件打开连接数
[root@iZ94eveq0q4Z~]#ulimit-n
65535
2)查看一下php-fpm配置文件里rlimit_files的值
;Setopenfiledescriptorrlimit#rlimit设置打开的文件描述符
;DefaultValue:systemdefinedvalue
rlimit_files=65535
如果两个值不一样,则要设置为一样
方法如下:
3)设置系统打开文件连接数
[root@hotdata~]#ulimit-HSn65535
[root@hotdata~]#ulimit-n
65535
[root@hotdata~]#
设置好后重启php-fpm服务
2、request_terminate_timeout=0设置为0
;Thetimeoutforservingasinglerequestafterwhichtheworkerprocesswill
;bekilled.Thisoptionshouldbeusedwhenthe‘max_execution_time'inioption
;doesnotstopscriptexecutionforsomereason.Avalueof'0′means‘off'.
;Availableunits:s(econds)(default),m(inutes),h(ours),ord(ays)
;DefaultValue:0
request_terminate_timeout=0
因为这个参数会直接杀掉php进程,然后重启php进程,这样前端nginx就会返回104:Connectionresetbypeer。这个过程是很慢,总体感觉就是网站很卡
nginx可能出现502
recv()failed(104:Connectionresetbypeer)whilereadingresponseheaderfromupstream
3、request_slowlog_timeout这个配置不要开启
之前服务器上开始了这个参数,并且设置如下:
request_slowlog_timeout=10导致图片处理每次都失败,每次都是502错误。
错误信息如下:
Nginx的错误信息:
2015/12/2816:20:23[error]649#0:*9862recv()failed(104:Connectionresetbypeer)whilereadingresponseheaderfromupstream,client:163.177.69.13,
php-fpm的错误信息为:
[28-Dec-201517:04:01]WARNING:[poolwww]child10520,script'/hotdata/kehu/foshang_niufeecms/index.php'(request:"GET/index.php")executiontimedout(10.451550sec),terminating
[28-Dec-201517:04:01]WARNING:[poolwww]child10512,script'/hotdata/kehu/foshang_niufeecms/index.php'(request:"GET/index.php")executiontimedout(12.396650sec),terminating
[28-Dec-201517:04:01]WARNING:[poolwww]child10520exitedonsignal15(SIGTERM)after73.413706secondsfromstart
[28-Dec-201517:04:01]NOTICE:[poolwww]child10909started
[28-Dec-201517:04:01]WARNING:[poolwww]child10512exitedonsignal15(SIGTERM)after73.421170secondsfromstart
[28-Dec-201517:04:01]NOTICE:[poolwww]child10910started/var/log/php-fpm/www-slow.log记录如下
[28-Dec-201516:23:17] [poolwww]pid2427
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]+++dumpfailed
所以最好是要这个设置给屏蔽掉。
;request_slowlog_timeout=10
以上这篇/etc/php-fpm.d/www.conf配置注意事项就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。