PHP为项目配置单独的进程池

配置示例

基于oneinstack安装包生成的配置文件

php-fpm配置文件

位置/usr/local/php/etc/php/php-fpm.conf

;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = warning

emergency_restart_threshold = 30
emergency_restart_interval = 60s
process_control_timeout = 5s
daemonize = yes

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

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

线程池配置目录

develop.conf

[develop]
//不同的线程池使用不同的sock文件
//nginx配置文件监听对应的sock
listen = /dev/shm/php-cgi.sock 
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = yangliuan
listen.group = yangliuan
listen.mode = 0666
user = yangliuan
group = yangliuan

pm = dynamic
pm.max_children = 6
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 6
pm.max_requests = 2048
pm.process_idle_timeout = 10s
request_terminate_timeout = 600
request_slowlog_timeout = 0

pm.status_path = /php-fpm_status
slowlog = var/log/slow.log
rlimit_files = 51200
rlimit_core = 0

catch_workers_output = yes
env[HOSTNAME] = yangliuan-TM1707
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp