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:
@@ -185,6 +185,15 @@ return array(
|
||||
'default' => 30,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_use_mod_proxy' => array(
|
||||
'label' => $lng['phpfpm']['use_mod_proxy'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'use_mod_proxy',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'visible' => Settings::Get('system.apache24'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -404,6 +404,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('phpfpm', 'defaultini', '1'),
|
||||
('phpfpm', 'vhost_defaultini', '2'),
|
||||
('phpfpm', 'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'),
|
||||
('phpfpm', 'use_mod_proxy', '0'),
|
||||
('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
|
||||
('system', 'lastaccountnumber', '0'),
|
||||
('system', 'lastguid', '9999'),
|
||||
|
||||
@@ -2803,5 +2803,9 @@ if (isFroxlorVersion('0.9.33-dev2')) {
|
||||
Settings::AddNew("panel.password_special_char", '!?<>§$%&+#=@');
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding settings for fpm-apache2.4-mod_proxy integration");
|
||||
Settings::AddNew("phpfpm.use_mod_proxy", '0');
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.33-dev3');
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
|
||||
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
|
||||
|
||||
// VERSION INFO
|
||||
$version = '0.9.33-dev2';
|
||||
$version = '0.9.33-dev3';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
@@ -1833,3 +1833,5 @@ $lng['serversettings']['panel_password_special_char_required']['title'] = 'Speci
|
||||
$lng['serversettings']['panel_password_special_char_required']['description'] = 'Password must contain at least one of the characters defined below.';
|
||||
$lng['serversettings']['panel_password_special_char']['title'] = 'Special characters list';
|
||||
$lng['serversettings']['panel_password_special_char']['description'] = 'One of these characters is required if the above option is set.';
|
||||
$lng['phpfpm']['use_mod_proxy']['title'] = 'Use mod_proxy / mod_proxy_fcgi';
|
||||
$lng['phpfpm']['use_mod_proxy']['description'] = 'Activate to use php-fpm via mod_proxy_fcgi. Requires at least apache-2.4.9';
|
||||
|
||||
@@ -1557,3 +1557,5 @@ $lng['serversettings']['panel_password_special_char_required']['title'] = 'Sonde
|
||||
$lng['serversettings']['panel_password_special_char_required']['description'] = 'Das Passwort muss mindestens eines der untenstehenden Sonderzeichen enthalten';
|
||||
$lng['serversettings']['panel_password_special_char']['title'] = 'Sonderzeichen-Liste';
|
||||
$lng['serversettings']['panel_password_special_char']['description'] = 'Mindestens eines dieser Sonderzeichen muss in dem Passwort vorkommen, sofern die Sonderzeichen-Option aktiviert ist.';
|
||||
$lng['phpfpm']['use_mod_proxy']['title'] = 'Verwende mod_proxy / mod_proxy_fcgi';
|
||||
$lng['phpfpm']['use_mod_proxy']['description'] = 'Diese Option kann aktiviert werden, um php-fpm via mod_proxy_fcgi einzubinden. Dies setzt mindestens apache-2.4.9 voraus';
|
||||
|
||||
@@ -259,6 +259,16 @@ class apache {
|
||||
if ($row_ipsandports['ssl']) {
|
||||
$srvName = substr(md5($ipport),0,4).'.ssl-fpm.external';
|
||||
}
|
||||
|
||||
// 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] .= ' 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']);
|
||||
@@ -277,6 +287,7 @@ class apache {
|
||||
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
|
||||
$this->virtualhosts_data[$vhosts_filename] .= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dirprotection, see #72
|
||||
|
||||
@@ -39,6 +39,16 @@ class apache_fcgid extends apache
|
||||
if (customerHasPerlEnabled($domain['customerid'])) {
|
||||
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\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.= ' 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";
|
||||
@@ -56,6 +66,7 @@ class apache_fcgid extends apache
|
||||
$php_options_text.= ' </Directory>' . "\n";
|
||||
$php_options_text.= ' Alias /fastcgiphp ' . $php->getInterface()->getAliasConfigDir() . $srvName . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$php_options_text.= ' FcgidIdleTimeout ' . Settings::Get('system.mod_fcgid_idle_timeout') . "\n";
|
||||
|
||||
Reference in New Issue
Block a user