您好,登錄后才能下訂單哦!
本篇內容主要講解“/etc/php-fpm.d/www.conf配置有哪些注意事項”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“/etc/php-fpm.d/www.conf配置有哪些注意事項”吧!
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配置有哪些注意事項”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。