php_fpm配置文件

php_fpm配置文件

php-fpm这个服务所使用的配置文件:/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/   //可以根据不同域名进行不同的限制


[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静态形式启动,只有pm.max_children = 50生效,其它不生效,启动50个php-fpm个子进程

pm = dynamic以动态形式启动,pm.start_servers = 20表示一开始就启动20个子进程

pm.min_spare_servers = 5表示php-fpm空闲时最少5个子进程,少了会自动启动

pm.max_requests = 500表示空闲时最多500个子进程,多了会自动清理

pm.max_requests = 500表示一个子进程最多可接受多少个请求,比如设置为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


你可能感兴趣的:(PHP,配置文件,fpm)