Shortly: how can I include the same settings across several php-fpm pools without repeating them for each pool?
Details
In php5-fpm there are global directives and per pool directives. In all examples and documentation, each pool has all required settings, e.g.
[www]
user = $pool
group = $pool
listen = 127.0.0.1:9001
listen.owner = $pool
listen.group = $pool
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 30s
chdir = /var/www/$pool
[www2]
user = $pool
group = $pool
listen = 127.0.0.1:9002
listen.owner = $pool
listen.group = $pool
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 30s
chdir = /var/www/$pool
As you can see, most of the configuraton is the same, so I wonder if there is a way to put that configuration in a place where all pools can implicitly or explictly include them.
Just putting them at the bottom of the [Global]
section is not working.
Thank you for any suggestion.
After trials and errors, I found that you can safely use the
include
directive to, well, include settings :-)I created an additional
/etc/php5/fpm/common.conf
file:And now all my pools can be as simple as this:
Additional notes:
yes, you have to specify the full path to the common file, because current path for fpm process is NOT the
pool.d
folderyes, all interpolation is done, so
$pool
becomeswww
orwww2
at runtimeHope this could be also useful to someone else.