背景
上周网站大部分页面都出现了502,服务起折腾了很久也没弄好,最后发现是vps服务商的主机节点发生了问题,并且导致了vps服务商整个巴黎数据中心崩溃,这下受影响的网站多了去了. 趁这个机会我优化了下php-fpm的4G内存配置文件,网站上找了下没有,现在列出来给需要的人参考
php-fpm.conf
;include=etc/fpm.d/*.conf
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
user = www
group = www
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 100
pm.start_servers = 40
pm.min_spare_servers = 25
pm.max_spare_servers = 80
pm.max_requests = 20480
pm.process_idle_timeout = 10
request_terminate_timeout = 300
slowlog = var/log/log.slow
request_slowlog_timeout = 120