php-fpm优化参数合集

listen.backlog int

设置 listen(2) 的 backlog 最大值。“-1”表示无限制。默认值:-1。

示例:

vim /usr/local/etc/php-fpm.d/www_socket.conf

将listen.backlog修改为:

listen.backlog = 1024

注意-1不弄代表无限制,-1在某些系统限制为128

rlimit_files = 30000

常见需要修改的地方:

vim /usr/local/etc/php-fpm.d/www_socket.conf

user = nobody
group = nobody

;listen = 127.0.0.1:9000

listen = /var/run/php-cgi.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

pm = dynamic

pm.max_children = 128

pm.start_servers = 5

pm.min_spare_servers = 5

pm.max_spare_servers = 10

pm.process_idle_timeout = 10s;

pm.max_requests = 1024

慢日志
slowlog = /var/log/php-fpm/www-slow.log
request_slowlog_timeout = 1

vim /usr/local/etc/php-fpm.conf

include=/usr/local/etc/php-fpm.d/*.conf

include路径一般要改下

 

https://www.cnblogs.com/xiaoleiel/p/8308486.html