您好,登錄后才能下訂單哦!
php_fpm配置文件
php-fpm這個服務(wù)所使用的配置文件:/usr/local/php/etc/php-fpm.conf
php全局配置文件:/usr/local/php/etc/php.ini
1、清空php-fpm的配置文件
[root@daixuan vhosts]#> /usr/local/php/etc/php-fpm.conf
[root@daixuan vhosts]# vim !$
vim /usr/local/php/etc/php-fpm.conf 輸入:
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
listen = /tmp/www.sock
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 10240
slowlog = /tmp/www_slow.log
request_slowlog_timeout = 1 //訪問超過1s記錄日志
php_admin_value[open_basedir]=/data/www/:/tmp/ //可以根據(jù)不同域名進行不同的限制
[www1]
listen = /tmp/www1.sock
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
定義了兩個池,www和www1
pm = static靜態(tài)形式啟動,只有pm.max_children = 50生效,其它不生效,啟動50個php-fpm個子進程
pm = dynamic以動態(tài)形式啟動,pm.start_servers = 20表示一開始就啟動20個子進程
pm.min_spare_servers = 5表示php-fpm空閑時最少5個子進程,少了會自動啟動
pm.max_spare_servers = 35表示空閑時最多35個子進程,多了會自動清理
pm.max_requests = 500表示一個子進程最多可接受多少個請求,比如設(shè)置為500,那么一個進程接受500個請求后自動銷毀
rlimit_files = 1024表示每個子進程打開1024個文件句柄
檢查php-fpm配置文件有沒有錯誤:
[root@daixuan vhosts]# /usr/local/php/sbin/php-fpm -t
[06-Jan-2016 20:30:57] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
重啟php-fpm
[root@daixuan vhosts]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。