Added Fast CGI Idle Timeout, patch by Slydder, fixes #1017

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2012-02-27 19:27:13 +01:00
parent 95b641060d
commit 7d6d683e52
9 changed files with 79 additions and 6 deletions

View File

@@ -236,6 +236,7 @@ class apache
{
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/' . $this->settings['system']['hostname']);
$this->virtualhosts_data[$vhosts_filename].= ' FastCgiConfig -idle-timeout ' . $this->settings['system']['mod_fcgid_idle_timeout'] . "\n";
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
@@ -273,7 +274,7 @@ class apache
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $mypath . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $mypath . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . " -idle-timeout " . $this->settings['phpfpm']['idle_timeout'] . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' <Directory "' . $mypath . '">' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' AddHandler php5-fastcgi .php'. "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Action php5-fastcgi /fastcgiphp' . "\n";
@@ -1295,6 +1296,28 @@ class apache
}
}
}
if($this->settings['phpfpm']['enabled'] == '1')
{
foreach($this->known_vhostfilenames as $vhostfilename){
$known_phpfpm_files[]=preg_replace('/^(05|10|20|21|22|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_/', '', $vhostfilename);
}
$configdir = $this->settings['phpfpm']['configdir'];
$phpfpm_file_dirhandle = opendir($this->settings['phpfpm']['configdir']);
while(false !== ($phpfpm_filename = readdir($phpfpm_file_dirhandle)))
{
if($phpfpm_filename != '.'
&& $phpfpm_filename != '..'
&& !in_array($phpfpm_filename, $known_phpfpm_files)
&& file_exists(makeCorrectFile($this->settings['phpfpm']['configdir'] . '/' . $phpfpm_filename)))
{
fwrite($this->debugHandler, ' apache::wipeOutOldVhostConfigs: unlinking PHP5-FPM ' . $phpfpm_filename . "\n");
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'unlinking ' . $phpfpm_filename);
unlink(makeCorrectFile($this->settings['phpfpm']['configdir'] . '/' . $phpfpm_filename));
}
}
}
}
/*

View File

@@ -38,7 +38,7 @@ class apache_fcgid extends apache
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($domain['documentroot']) . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . "\n";
$php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($domain['documentroot']) . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . " -idle-timeout " . $this->settings['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";
@@ -52,6 +52,7 @@ class apache_fcgid extends apache
}
else
{
$php_options_text.= ' FastCgiConfig -idle-timeout ' . $this->settings['system']['mod_fcgid_idle_timeout'] . "\n";
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";