php-fpm pool per virtual host?

rstefanov

Registered
Oct 7, 2013
1
0
1
cPanel Access Level
Website Owner
Hello,

I am wondering if it is possible to configure cpanel and php-fpm with different pool per virtual host?

Atm I am using configuration similar to this post https://forums.cpanel.net/f189/php-fpm-fastcgi-apc-293802.html#post1224672 It works pretty well. However, for security reasons I would like to configure each virtual host with different php-fpm pool. Is there anything you can suggest?

Also, if there is no such tool/plugin or w/e, could you tell me how to apply a custom configuration for a specific virtualhost? For example:

Code:
LoadModule fastcgi_module modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
        FastCGIExternalServer /usr/sbin/php-fpm -host 127.0.0.1:9000
        AddHandler php-fastcgi .php

        #<LocationMatch "/status">
        #  SetHandler php-fastcgi-virt
        #  Action php-fastcgi-virt /usr/sbin/php-fpm.fcgi virtual
        #</LocationMatch>

        Action php-fastcgi /usr/sbin/php-fpm.fcgi
        ScriptAlias /usr/sbin/php-fpm.fcgi /usr/sbin/php-fpm

        <Directory /usr/sbin>
        Options ExecCGI FollowSymLinks
        SetHandler fastcgi-script
        Order allow,deny
        Allow from all
        </Directory>
</IfModule>
I would like to change tcp ports per virtual host individually, or even use unix sockets:

FastCGIExternalServer /usr/sbin/php-fpm -host 127.0.0.1:9000
to
FastCGIExternalServer /usr/sbin/php-fpm -host 127.0.0.1:9001

So where can I set up custom tcp port for vh? Can I just reuse that snippet at /usr/local/apache/conf/userdata/std/2/$user/$domain/$includename.conf or?

Thanks!