1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| #第一部分,fpm配置 ;include=etc/fpm.d/*.conf
#第二部分,全局配置 [global] ;pid = /var/log/php-fpm/php-fpm.pid #pid文件存放的位置 ;error_log = /var/log/php-fpm/php-fpm.log #错误日志存放的位置 ;log_level = error #日志级别, alert, error, warning, notice, debug rlimit_files = 65535 #php-fpm进程能打开的文件数 events.mechanism = epoll #使用epoll事件模型处理请求
#第三部分,进程池定义 [www] #池名称 user = www #进程运行的用户 group = www #进程运行的组 ;listen = /dev/shm/php-fpm.sock #监听在本地socket文件 listen = 127.0.0.1:9000 #监听在本地tcp的9000端口 ;listen.allowed_clients = 127.0.0.1 #允许访问FastCGI进程的IP,any不限制
; Choose how the process manager will control the number of child processes. ; Possible Values: ; static - a fixed number (pm.max_children) of child processes; ; dynamic - the number of child processes are set dynamically based on the ; following directives: ; pm.max_children - the maximum number of children that can ; be alive at the same time. ; pm.start_servers - the number of children created on startup. ; pm.min_spare_servers - the minimum number of children in 'idle' ; state (waiting to process). If the number ; of 'idle' processes is less than this ; number then some children will be created. ; pm.max_spare_servers - the maximum number of children in 'idle' ; state (waiting to process). If the number ; of 'idle' processes is greater than this ; number then some children will be killed. ; Note: This value is mandatory.
pm = dynamic # pm.max_children = 512 #最大启动的php-fpm进程数 pm.start_servers = 32 #初始启动的php-fpm进程数 pm.min_spare_servers = 32 #最少的空闲php-fpm进程数 pm.max_spare_servers = 64 #最大的空闲php-fpm进程数 pm.max_requests = 1500 #每一个进程能响应的请求数 pm.process_idle_timeout = 15s;
# 错误日志 php_flag[display_errors] = off php_admin_value[error_log] = /soft/log/php/php-www_error.log php_admin_flag[log_errors] = on
# 将查询超过5s的连接记录至慢查询日志中 request_slowlog_timeout = 5s slowlog = /var/log/php/slow.log
|