php-fpm 优化

Posted pansidong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php-fpm 优化相关的知识,希望对你有一定的参考价值。

 

/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
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 40
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 40
request_terminate_timeout = 0
request_slowlog_timeout = 0
slowlog = var/log/slow.log






————优化后—————





[[email protected] etc]# cat php-fpm.conf
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 240
pm.start_servers = 30
pm.min_spare_servers = 30
pm.max_spare_servers = 180
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log
catch_workers_output = yes

 

以上是关于php-fpm 优化的主要内容,如果未能解决你的问题,请参考以下文章

php-fpm 优化

php-fpm优化方法详解

PHP 性能优化之 PHP-FPM

php-fpm参数优化

PHP配置优化:php-fpm配置解读

PHP-FPM实现性能优化