Home > Article > Backend Development > php-fpm.conf configuration instructions
This article mainly introduces the configuration instructions of php-fpm.conf, which has certain reference value. Now I share it with everyone. Friends in need can refer to it
[global] pid = /usr/local/php/var/run/php-fpm.pid error_log = /alidata/log/php/php-fpm.log # 错误级别。可用级别为:alert(必须立即处理),error(错误情况), # warning(警告情况),notice(一般重要信息),debug(调试信息)。 # 默认:notice。log_level = notice [www] listen = /tmp/php-cgi.sock listen.backlog = -1listen.allowed_clients = 127.0.0.1listen.owner = www listen.group = www listen.mode = 0666user = www group = www # 启动时子进程管理方式,可选值:static(启动时创建指定个数), # dynamic(启动时根据情况创建,至少有一个), # ondemand(启动时不创建子进程,有需求才创建)pm = dynamic # 当动态管理子进程时,fpm最多能fork多少个进程, 三种管理方式都要配置pm.max_children = 140 # fpm启动时创建40个子进程,只适用动态dynamic管理方式 # 默认值:min_spare_servers + (max_spare_servers - min_spare_servers) / 2。pm.start_servers = 40 # 服务器闲置时最少保持20个子进程,不够这个数就会创建,只适用动态dynamic管理方式pm.min_spare_servers = 20 # 服务器闲置时最多要有几个,多了会kill,只适用动态dynamic管理方式pm.max_spare_servers = 60 # max_requests 使FastCGI进程在处理一定数量的请求后自动重启, # 以此避免第三方扩展内存泄漏产生破坏性影响。 # 注意: 该参数设置要注意,设置大了不利于解决内存泄漏问题,导致耗内存较多 # 设置小了FastCGI频繁重启,会对CPU产生了负担,要权衡考虑pm.max_requests = 5000 # 最长执行时间request_terminate_timeout = 100 # 慢日志request_slowlog_timeout = 2slowlog = /alidata/log/php/slow.log
Related recommendations:
Detailed explanation of the operating principle of Nginx Php-fpm
Detailed explanation of the Nginx configuration file nginx.conf
The above is the detailed content of php-fpm.conf configuration instructions. For more information, please follow other related articles on the PHP Chinese website!