From 4cd75e5ecab0700a28169eb09bc0a21f15e59c0f Mon Sep 17 00:00:00 2001 From: Thom Pol <> Date: Mon, 22 Feb 2021 19:34:36 +0100 Subject: [PATCH] Use php-fpm instead of mod_php, enable http2 (#11 and #28) --- lib/os/class.ISPConfigDebianOS.inc.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index e5c8a5a..3085d13 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -158,7 +158,7 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { } protected function getApacheModulesToEnable() { - $modules = array('suexec', 'rewrite', 'ssl', 'actions', 'include', 'dav_fs', 'dav', 'auth_digest', 'cgi', 'headers', 'proxy_fcgi', 'alias'); + $modules = array('suexec', 'rewrite', 'ssl', 'actions', 'include', 'dav_fs', 'dav', 'auth_digest', 'cgi', 'headers', 'proxy_fcgi', 'alias', 'http2', 'mpm_event'); return $modules; } @@ -774,7 +774,6 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; 'apache2-utils', 'libapache2-mod-fcgid', 'apache2-suexec-pristine', - 'libapache2-mod-php', 'libapache2-mod-python', 'libapache2-mod-passenger' ); @@ -852,6 +851,15 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; $this->installPackages($packages); if(ISPConfig::shallInstall('web') && ISPConfig::$WEBSERVER === ISPC_WEBSERVER_APACHE) { + // Disable mpm_prefork so mpm_event can be used with http2 + ISPConfigLog::info('Disabling mpm_prefork module.', true); + $modules = 'mpm_prefork'; + $cmd = 'a2dismod ' . $modules . ' 2>&1'; + $result = $this->exec($cmd); + if($result === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + } + ISPConfigLog::info('Enabling apache modules.', true); $modules = $this->getApacheModulesToEnable(); $cmd = 'a2enmod ' . implode(' ', $modules) . ' 2>&1'; @@ -859,6 +867,16 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; if($result === false) { throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); } + + ISPConfigLog::info('Enabling default PHP-FPM config.', true); + $conf = 'php' . $this->getSystemPHPVersion() . '-fpm'; + $cmd = 'a2enconf ' . $conf . ' 2>&1'; + $result = $this->exec($cmd); + if($result === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + } + + $this->restartService('apache2'); } try { -- GitLab