php_fpm配置文件
創(chuàng)新互聯(lián)建站主打移動(dòng)網(wǎng)站、成都網(wǎng)站制作、成都做網(wǎng)站、網(wǎng)站改版、網(wǎng)絡(luò)推廣、網(wǎng)站維護(hù)、域名與空間、等互聯(lián)網(wǎng)信息服務(wù),為各行業(yè)提供服務(wù)。在技術(shù)實(shí)力的保障下,我們?yōu)榭蛻舫兄Z穩(wěn)定,放心的服務(wù),根據(jù)網(wǎng)站的內(nèi)容與功能再?zèng)Q定采用什么樣的設(shè)計(jì)。最后,要實(shí)現(xiàn)符合網(wǎng)站需求的內(nèi)容、功能與設(shè)計(jì),我們還會(huì)規(guī)劃穩(wěn)定安全的技術(shù)方案做保障。
php-fpm這個(gè)服務(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ù)不同域名進(jìn)行不同的限制
[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
定義了兩個(gè)池,www和www1
pm = static靜態(tài)形式啟動(dòng),只有pm.max_children = 50生效,其它不生效,啟動(dòng)50個(gè)php-fpm個(gè)子進(jìn)程
pm = dynamic以動(dòng)態(tài)形式啟動(dòng),pm.start_servers = 20表示一開始就啟動(dòng)20個(gè)子進(jìn)程
pm.min_spare_servers = 5表示php-fpm空閑時(shí)最少5個(gè)子進(jìn)程,少了會(huì)自動(dòng)啟動(dòng)
pm.max_spare_servers = 35表示空閑時(shí)最多35個(gè)子進(jìn)程,多了會(huì)自動(dòng)清理
pm.max_requests = 500表示一個(gè)子進(jìn)程最多可接受多少個(gè)請(qǐng)求,比如設(shè)置為500,那么一個(gè)進(jìn)程接受500個(gè)請(qǐng)求后自動(dòng)銷毀
rlimit_files = 1024表示每個(gè)子進(jìn)程打開1024個(gè)文件句柄
檢查php-fpm配置文件有沒有錯(cuò)誤:
[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