Skip to content

Instantly share code, notes, and snippets.

@ottonet
Created January 11, 2016 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ottonet/3335d30ed464bc720c31 to your computer and use it in GitHub Desktop.
Save ottonet/3335d30ed464bc720c31 to your computer and use it in GitHub Desktop.
nginx route to different php processors, you could have some php processing done by v5, some by v7 and even some by hhvm if you'd want that.. .
# Default is to use pool 1
set $custom_php_pool "1";
# If is /admin, we use pool 2
if ($uri ~* "^/index.php/admin/") {
set $custom_php_pool "2";
}
if ($uri ~* "^/qbonline/") {
set $custom_php_pool "2";
}
if ($uri ~* "^/api/") {
set $custom_php_pool "1";
}
if ($uri ~* "^/index.php/admin/sales_order_create/") {
set $custom_php_pool "1";
}
if ($uri ~* "^/index.php/admin/sales_order_edit/") {
set $custom_php_pool "1";
}
location ~ \.php$ {
if ($custom_php_pool = '1') {
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
if ($custom_php_pool = '2') { fastcgi_pass 127.0.0.1:9007; }
fastcgi_index index.php;
fastcgi_read_timeout 600;
include fastcgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment