Skip to content

Commit

Permalink
Use FPM TCP port where available
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Feb 27, 2017
1 parent 2fc4c17 commit b3cbbb1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1034,13 +1034,17 @@ sub feature_get_web_php_mode
my @locs = &find("location", $server);
my ($loc) = grep { $_->{'words'}->[0] eq '~' &&
$_->{'words'}->[1] eq '\.php$' } @locs;
my $fpmsock = &virtual_server::get_php_fpm_socket_file($d);
my $fpmsock = &virtual_server::get_php_fpm_socket_file($d, 1);
my $fpmport = $d->{'php_fpm_port'};
if ($loc) {
my ($pass) = &find("fastcgi_pass", $loc);
if ($pass && $pass->{'words'}->[0] =~ /^(localhost|unix):(.*)$/) {
if ($1 eq "unix" && $2 eq $fpmsock) {
return 'fpm';
}
elsif ($1 eq "localhost" && $fpmport && $2 eq $fpmport) {
return 'fpm';
}
else {
return 'fcgid';
}
Expand Down Expand Up @@ -1076,7 +1080,8 @@ sub feature_save_web_php_mode
elsif ($mode eq "fpm" && $oldmode ne "fpm") {
# Setup FPM pool
&virtual_server::create_php_fpm_pool($d);
$port = &virtual_server::get_php_fpm_socket_file($d);
$port = $d->{'php_fpm_port'} ||
&virtual_server::get_php_fpm_socket_file($d);
}

# Update the port in the config, if changed
Expand Down

0 comments on commit b3cbbb1

Please sign in to comment.