perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
855 stars 246 forks source link

PHP-FPM Pools for Different Sites/Servers #119

Open 58bits opened 11 years ago

58bits commented 11 years ago

Hello again António,

By including apps/drupal/drupal.conf (or the boost vesrion) the choice of PHP-FPM pool has already been set.

Is it possible to configure a site (virtual server) to use the same Drupal include file, but a different PHP-FPM pool name? Perhaps with a variable setting?

Thoughts?

Best,

Tony

58bits commented 11 years ago

Or what about creating a map_upstream.conf file as follows?

map $http_host $fpm_pool { default phpfpm; mydomain1.com pool_1; mydomain2.com pool_2; mydomain3.com pool_3; }

and then wherever fastcgi_pass appears we use...

fastcgi_pass $fpm_pool;

... to tell fastcgi_pass which upstream server we would like to use, which in turn contrains the desired fpm pool connection information.

perusio commented 11 years ago

I don't think that will work because upstream doesn't handle variables AFAIK. I would use two different locations that have different upstreams, yeah it's ugly, but it should work :(

Pedro-Miguel commented 11 years ago

Hi,

I end up using the solution of 58bits.

I create the /etc/nginx/map_upstream.conf file and put on nginx.conf a include to that file. On all references for "fastcgi_pass phpcgi;" I replace with "fastcgi_pass $fpm_pool;"

Well, I loose load balancers but my main goal was put all sites on the same server having each one a own php-fpm pool.

So that solution works for me... Now more than 50 sites on the server have each one own pfp-fpm pool. (this way we can have APC on each drupal instalation).