Different php-fpm for each lighttpd vhost

#Edit /etc/php5/fpm/php-fpm.conf
Add line “include=/etc/php5/fpm/pool.d/*.conf”
#if it isn’t in there already.

cd /etc/php5/fpm/pool.d

#We have to create a new .conf file for each vhost, so I copy the default one

cp www.conf myvhost.conf
vim myvhost.conf

#Edit the following:

[www] to [domain.tld]
listen = to :9001
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1

Repeat this step for each vhost you have. Increment the port by 1 for each vhost and don’t forget to change the process name at the top ([www]), as well.

#Add this to each of your lighttpd vhosts:

fastcgi.server = ( ".php" =>
                    ( "localhost" =>
                            "host" => "",
                            "port" => "9001"

Where the port is of course the port you specified in the php-fpm config file. You don’t have to mention the individual .conf files we just made anywhere (since php-fpm.conf includes them all), just the port.

And then restart php-fpm

/etc/init.d/php5-fpm restart

Leave a Reply

Your email address will not be published. Required fields are marked *