smeserver-php-fpm/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig
2017-07-14 12:23:57 +02:00

65 lines
2.6 KiB
Plaintext

{
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
FastCgiIpcDir /var/run/mod_fastcgi
FastCgiWrapper Off
FastCgiConfig -idle-timeout 40 -maxClassProcesses 1
<Location /php-cgi-bin/>
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
# 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
# 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
# Shared Folders
_EOF
foreach my $share ($a->get_all_by_prop(type => 'share')){
next if ($share->prop('DynamicContent' || 'disabled') ne 'enabled');
my $key = $share->key;
my $ver = $share->prop('PHPVersion') || '';
$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
_EOF
# Custom PHP pools
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
_EOF
}
}
else{
$OUT .= '# Using mod_proxy_fcgi, no additional config required'
}
}