add possibility to use php-fpm over mod_proxy_fcgi with apache >=2.4.9

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-11-10 11:47:27 +01:00
parent 4cc3c01dcb
commit 5499388777
8 changed files with 70 additions and 30 deletions

View File

@@ -259,23 +259,34 @@ class apache {
if ($row_ipsandports['ssl']) {
$srvName = substr(md5($ipport),0,4).'.ssl-fpm.external';
}
$this->virtualhosts_data[$vhosts_filename] .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName .' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' <Directory "' . $mypath . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$this->virtualhosts_data[$vhosts_filename] .= ' <FilesMatch "\.(' . implode('|', $file_extensions) . ')$">' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' AddHandler php5-fastcgi .php'. "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' Action php5-fastcgi /fastcgiphp' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Options +ExecCGI' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' </FilesMatch>' . "\n";
// >=apache-2.4 enabled?
if (Settings::Get('system.apache24') == '1') {
$this->virtualhosts_data[$vhosts_filename] .= ' Require all granted' . "\n";
// mod_proxy stuff for apache-2.4
if (Settings::Get('system.apache24') == '1'
&& Settings::Get('phpfpm.use_mod_proxy') == '1'
) {
$this->virtualhosts_data[$vhosts_filename] .= ' <FilesMatch \.php$>'. "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' SetHandler proxy:unix:' . $php->getInterface()->getSocketFile() . '|fcgi://localhost/'. "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' </FilesMatch>' . "\n";
} else {
$this->virtualhosts_data[$vhosts_filename] .= ' Order allow,deny' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' allow from all' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName .' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' <Directory "' . $mypath . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$this->virtualhosts_data[$vhosts_filename] .= ' <FilesMatch "\.(' . implode('|', $file_extensions) . ')$">' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' AddHandler php5-fastcgi .php'. "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' Action php5-fastcgi /fastcgiphp' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Options +ExecCGI' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' </FilesMatch>' . "\n";
// >=apache-2.4 enabled?
if (Settings::Get('system.apache24') == '1') {
$this->virtualhosts_data[$vhosts_filename] .= ' Require all granted' . "\n";
} else {
$this->virtualhosts_data[$vhosts_filename] .= ' Order allow,deny' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' allow from all' . "\n";
}
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
}
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
}
/**

View File

@@ -39,22 +39,33 @@ class apache_fcgid extends apache
if (customerHasPerlEnabled($domain['customerid'])) {
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
}
$php_options_text.= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' <FilesMatch "\.php$">' . "\n";
$php_options_text.= ' SetHandler php5-fastcgi'. "\n";
$php_options_text.= ' Action php5-fastcgi /fastcgiphp' . "\n";
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' </FilesMatch>' . "\n";
// >=apache-2.4 enabled?
if (Settings::Get('system.apache24') == '1') {
$php_options_text.= ' Require all granted' . "\n";
// mod_proxy stuff for apache-2.4
if (Settings::Get('system.apache24') == '1'
&& Settings::Get('phpfpm.use_mod_proxy') == '1'
) {
$php_options_text.= ' <FilesMatch \.php$>'. "\n";
$php_options_text.= ' SetHandler proxy:unix:' . $php->getInterface()->getSocketFile() . '|fcgi://localhost/'. "\n";
$php_options_text.= ' </FilesMatch>' . "\n";
} else {
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
$php_options_text.= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' <FilesMatch "\.php$">' . "\n";
$php_options_text.= ' SetHandler php5-fastcgi'. "\n";
$php_options_text.= ' Action php5-fastcgi /fastcgiphp' . "\n";
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' </FilesMatch>' . "\n";
// >=apache-2.4 enabled?
if (Settings::Get('system.apache24') == '1') {
$php_options_text.= ' Require all granted' . "\n";
} else {
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
}
$php_options_text.= ' </Directory>' . "\n";
$php_options_text.= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
}
$php_options_text.= ' </Directory>' . "\n";
$php_options_text.= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
}
else
{