From 6996f6516cc0010b9b19cd695ce2bdec95a82cd3 Mon Sep 17 00:00:00 2001 From: Christian Becker Date: Sat, 14 Nov 2015 14:10:23 +0100 Subject: [PATCH] fix ssl setttings for rewrite vhosts on nginx, fixes #1568 - previously the ssl settings were missing in rewrite vhosts - this caused ssl errors for these hosts as the default certificate has been used instead of the vhost specific cert. - this seem to only apply for nginx, not apache --- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 60e2f91c..79dcc445 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -419,6 +419,14 @@ class nginx extends HttpConfigBase { $domain['documentroot'] = 'https://' . $domain['domain'] . $_sslport . '/'; } + // create ssl settings first since they are required for normal and redirect vhosts + if ($ssl_vhost === true + && $domain['ssl'] == '1' + && Settings::Get('system.use_ssl') == '1' + ) { + $vhost_content.= "\n" . $this->composeSslSettings($domain) . "\n"; + } + // if the documentroot is an URL we just redirect if (preg_match('/^https?\:\/\//', $domain['documentroot'])) { $uri = $this->idnaConvert->encode($domain['documentroot']); @@ -434,12 +442,6 @@ class nginx extends HttpConfigBase { if ($this->_deactivated == false) { - if ($ssl_vhost === true - && $domain['ssl'] == '1' - && Settings::Get('system.use_ssl') == '1' - ) { - $vhost_content.= $this->composeSslSettings($domain); - } $vhost_content = $this->mergeVhostCustom($vhost_content, $this->create_pathOptions($domain)) . "\n"; $vhost_content.= $this->composePhpOptions($domain, $ssl_vhost);