Simplify mod_fastcgi config template

tags/0.0.1_0.fc26_el6 0.0.1_0.fc26_el6
Daniel Berteaud 8 years ago
parent 05acd70658
commit fa3d2112cd
  1. 36
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig

@ -1,8 +1,10 @@
{
use esmith::AccountsDB;
use esmith::ConfigDB;
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database";
my $p = esmith::ConfigDB->open_ro('php') || esmith::ConfigDB->create('php');
if ($fastcgi_mod eq 'mod_fastcgi'){
$OUT .=<<_EOF;
# mod_fastcgi global config
@ -13,28 +15,20 @@ FastCgiConfig -idle-timeout 40 -maxClassProcesses 1
Allow from all
</Location>
# Stock PHP
Action php-fastcgi /php-cgi-bin/php-wrapper
Alias /php-cgi-bin/php-wrapper /var/www/php-cgi-bin/php-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php-wrapper -socket /var/run/php-fpm/php.sock -pass-header Authorization -idle-timeout 120
# PHP 5.6
Action php56-fastcgi /php-cgi-bin/php56-wrapper
Alias /php-cgi-bin/php56-wrapper /var/www/php-cgi-bin/php56-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php56-wrapper -socket /var/run/php-fpm/php56.sock -pass-header Authorization -idle-timeout 120
_EOF
# PHP 7.0
Action php70-fastcgi /php-cgi-bin/php70-wrapper
Alias /php-cgi-bin/php70-wrapper /var/www/php-cgi-bin/php70-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php70-wrapper -socket /var/run/php-fpm/php70.sock -pass-header Authorization -idle-timeout 120
foreach my $ver ('', '56', '70', '71'){
$OUT .=<<_EOF;
# PHP 7.1
Action php71-fastcgi /php-cgi-bin/php71-wrapper
Alias /php-cgi-bin/php71-wrapper /var/www/php-cgi-bin/php71-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php71-wrapper -socket /var/run/php-fpm/php71.sock -pass-header Authorization -idle-timeout 120
Action php$ver-fastcgi /php-cgi-bin/php$ver-wrapper
Alias /php-cgi-bin/php$ver-wrapper /var/www/php-cgi-bin/php$ver-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php$ver-wrapper -socket /var/run/php-fpm/php$ver.sock -pass-header Authorization -idle-timeout 120
# Shared Folders
_EOF
}
$OUT .= "# Shared Folders\n";
foreach my $share ($a->get_all_by_prop(type => 'share')){
next if ($share->prop('DynamicContent' || 'disabled') ne 'enabled');
my $key = $share->key;
@ -46,18 +40,22 @@ _EOF
$socket = "php$ver-$custom.sock";
}
$OUT .=<<_EOF;
Action php$key-fastcgi /php-cgi-bin/php$key-wrapper
Alias /php-cgi-bin/php$key-wrapper /var/www/php-cgi-bin/php$key-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/$socket -pass-header Authorization -idle-timeout 120
_EOF
}
}
$OUT .= "# Custom PHP pools\n";
foreach my $pool ($p->get_all_by_prop(type => 'pool')){
next if (($pool->prop('status') || 'enabled') ne 'enabled');
my $key = $pool->key;
my $ver = $pool->prop('Version') || '';
$OUT .=<<_EOF;
Action php$key-fastcgi /php-cgi-bin/php$key-wrapper
Alias /php-cgi-bin/php$key-wrapper /var/www/php-cgi-bin/php$key-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/php$ver-$key.sock -pass-header Authorization -idle-timeout 120

Loading…
Cancel
Save