/etc/php-fpm.d/www.conf 配置注意事項(xiàng)
1、php-fpm 配置文件里 rlimit_files的值 要與系統(tǒng)的打開(kāi)連接數(shù)一致
1)查看系統(tǒng)文件打開(kāi)連接數(shù)
[root@iZ94eveq0q4Z ~]# ulimit -n
65535
2)查看一下php-fpm 配置文件里 rlimit_files的值
; Set open file descriptor rlimit#rlimit設(shè)置打開(kāi)的文件描述符
; Default Value: system defined value
rlimit_files = 65535
如果兩個(gè)值不一樣,則要設(shè)置為一樣
方法如下:
3)設(shè)置系統(tǒng)打開(kāi)文件連接數(shù)
[root@hotdata ~]# ulimit -HSn 65535
[root@hotdata ~]# ulimit -n
65535
[root@hotdata ~]#
設(shè)置好后重啟php-fpm服務(wù)
2、 request_terminate_timeout = 0 設(shè)置為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
因?yàn)檫@個(gè)參數(shù)會(huì)直接殺掉php進(jìn)程,然后重啟php進(jìn)程,這樣前端nginx就會(huì)返回104: Connection reset by peer。這個(gè)過(guò)程是很慢,總體感覺(jué)就是網(wǎng)站很卡
nginx可能出現(xiàn)502
recv() failed (104: Connection reset by peer) while reading response header from upstream
3、request_slowlog_timeout這個(gè)配置不要開(kāi)啟
之前服務(wù)器上開(kāi)始了這個(gè)參數(shù),并且設(shè)置如下:
request_slowlog_timeout = 10導(dǎo)致圖片處理每次都失敗,每次都是502錯(cuò)誤。
錯(cuò)誤信息如下:
Nginx的錯(cuò)誤信息:
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的錯(cuò)誤信息為:
[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
所以最好是要這個(gè)設(shè)置給屏蔽掉。
;request_slowlog_timeout = 10
以上這篇/etc/php-fpm.d/www.conf 配置注意事項(xiàng)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- php配置php-fpm啟動(dòng)參數(shù)及配置詳解
- 基于php-fpm的配置詳解
- 安裝配置php-fpm來(lái)搭建Nginx+PHP的生產(chǎn)環(huán)境
- nginx調(diào)用php-fpm出錯(cuò)解決方法和nginx配置詳解
- 實(shí)現(xiàn)Nginx中使用PHP-FPM時(shí)記錄PHP錯(cuò)誤日志的配置方法
- nginx php-fpm中啟用慢日志配置(用于檢測(cè)執(zhí)行較慢的PHP腳本)
- Linux系統(tǒng)下PHP-FPM的安裝和配置教程
- ubuntu10.04配置 nginx+php-fpm模式的詳解
- php環(huán)境配置之CGI、FastCGI、PHP-CGI、PHP-FPM、Spawn-FCGI比較?
- nginx+php-fpm配置文件的組織結(jié)構(gòu)介紹
- CentOS6 配置Nginx,MySql,php-fpm開(kāi)機(jī)啟動(dòng)的方法
- nginx php-fpm環(huán)境中chroot功能的配置使用方法
- linux下的php-fpm參數(shù)配置介紹與參數(shù)優(yōu)化說(shuō)明
- php-fpm配置詳解
- 詳解Linux下安裝php環(huán)境并且配置Nginx支持php-fpm模塊
- php-fpm.conf配置文件中文說(shuō)明詳解及重要參數(shù)說(shuō)明
相關(guān)文章
php session實(shí)現(xiàn)多級(jí)目錄存放實(shí)現(xiàn)代碼
這篇文章主要介紹了php session實(shí)現(xiàn)多級(jí)目錄存放實(shí)現(xiàn)代碼,需要的朋友可以參考下2016-02-02
PHP基于GD2函數(shù)庫(kù)實(shí)現(xiàn)驗(yàn)證碼功能示例
這篇文章主要介紹了PHP基于GD2函數(shù)庫(kù)實(shí)現(xiàn)驗(yàn)證碼功能,簡(jiǎn)單介紹了GD2函數(shù)庫(kù)的常用函數(shù),并結(jié)合實(shí)例形式分析了php實(shí)現(xiàn)驗(yàn)證碼功能相關(guān)操作技巧,需要的朋友可以參考下2019-01-01

