From d15f5a7d058162fff137501fd139d504e06fdab2 Mon Sep 17 00:00:00 2001 From: Thom Date: Mon, 29 Mar 2021 15:45:33 +0000 Subject: [PATCH] Only add http2 to nginx vhost if SSL is enabled (#6127) --- install/lib/installer_base.lib.php | 4 ++-- install/tpl/nginx_apps.vhost.master | 4 ++-- install/tpl/nginx_ispconfig.vhost.master | 4 ++-- server/conf/nginx_apps.vhost.master | 4 ++-- server/plugins-available/apps_vhost_plugin.inc.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index eb3a65bd96..42a3b1792a 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2627,7 +2627,7 @@ class installer_base { // Enable SSL if a cert is in place. if(is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.crt') && is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.key')) { - $content = str_replace('{ssl_on}', 'ssl', $content); + $content = str_replace('{ssl_on}', 'ssl http2', $content); $content = str_replace('{ssl_comment}', '', $content); } else { $content = str_replace('{ssl_on}', '', $content); @@ -3524,7 +3524,7 @@ class installer_base { $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content); if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { - $content = str_replace('{ssl_on}', 'ssl', $content); + $content = str_replace('{ssl_on}', 'ssl http2', $content); $content = str_replace('{ssl_comment}', '', $content); $content = str_replace('{fastcgi_ssl}', 'on', $content); } else { diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master index de48420054..181f4c807e 100644 --- a/install/tpl/nginx_apps.vhost.master +++ b/install/tpl/nginx_apps.vhost.master @@ -1,6 +1,6 @@ server { - listen {apps_vhost_ip}{apps_vhost_port} {ssl_on} http2; - listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on http2; + listen {apps_vhost_ip}{apps_vhost_port} {ssl_on}; + listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on; {ssl_comment}ssl_protocols TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; diff --git a/install/tpl/nginx_ispconfig.vhost.master b/install/tpl/nginx_ispconfig.vhost.master index e1c39ee98b..dbe44d7064 100644 --- a/install/tpl/nginx_ispconfig.vhost.master +++ b/install/tpl/nginx_ispconfig.vhost.master @@ -1,6 +1,6 @@ server { - listen {vhost_port} {ssl_on} http2; - listen [::]:{vhost_port} {ssl_on} ipv6only=on http2; + listen {vhost_port} {ssl_on}; + listen [::]:{vhost_port} {ssl_on} ipv6only=on; {ssl_comment}ssl_protocols TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; diff --git a/server/conf/nginx_apps.vhost.master b/server/conf/nginx_apps.vhost.master index de48420054..181f4c807e 100644 --- a/server/conf/nginx_apps.vhost.master +++ b/server/conf/nginx_apps.vhost.master @@ -1,6 +1,6 @@ server { - listen {apps_vhost_ip}{apps_vhost_port} {ssl_on} http2; - listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on http2; + listen {apps_vhost_ip}{apps_vhost_port} {ssl_on}; + listen [::]:{apps_vhost_port} {ssl_on} ipv6only=on; {ssl_comment}ssl_protocols TLSv1.2; {ssl_comment}ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt; diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index d391633b62..91a994b109 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -209,7 +209,7 @@ class apps_vhost_plugin { /* Check if SSL should be enabled: */ if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) { $content = str_replace('{ssl_comment}', '', $content); - $content = str_replace('{ssl_on}', 'ssl', $content); + $content = str_replace('{ssl_on}', 'ssl http2', $content); } else { $content = str_replace('{ssl_comment}', '#', $content); $content = preg_replace('/(\s)\{ssl_on\}/', '', $content); -- GitLab