From d24056c9258f6563734fbe962c8f8b9553396f8e Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 22 Nov 2019 16:12:11 +0100 Subject: [PATCH] fix vhost-merging of specialsettings in nginx; fixes #757 Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cron/Http/Nginx.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index 8d869103..7da25eac 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -537,7 +537,7 @@ class Nginx extends HttpConfigBase } if ($domain['ssl_specialsettings'] != '' && $ssl_vhost == true) { - $vhost_content .= $this->processSpecialConfigTemplate($domain['ssl_specialsettings'], $domain, $domain['ip'], $domain['port'], $ssl_vhost) . "\n"; + $vhost_content = $this->mergeVhostCustom($vhost_content, $this->processSpecialConfigTemplate($domain['ssl_specialsettings'], $domain, $domain['ip'], $domain['port'], $ssl_vhost)); } if ($_vhost_content != '') { @@ -549,7 +549,7 @@ class Nginx extends HttpConfigBase } if (Settings::Get('system.default_sslvhostconf') != '' && $ssl_vhost == true) { - $vhost_content .= $this->processSpecialConfigTemplate(Settings::Get('system.default_sslvhostconf'), $domain, $domain['ip'], $domain['port'], $ssl_vhost) . "\n"; + $vhost_content = $this->mergeVhostCustom($vhost_content, $this->processSpecialConfigTemplate(Settings::Get('system.default_sslvhostconf'), $domain, $domain['ip'], $domain['port'], $ssl_vhost) . "\n"); } } } @@ -562,6 +562,8 @@ class Nginx extends HttpConfigBase { // Remove windows linebreaks $vhost = str_replace("\r", "\n", $vhost); + // remove comments + $vhost = implode("\n", preg_replace('/^(\s+)?#(.*)$/', '', explode("\n", $vhost))); // Break blocks into lines $vhost = str_replace(array( "{",