From 38b537710481e8a90e710ac5b360dced9e8880df Mon Sep 17 00:00:00 2001
From: florian030 <florian@schaal-24.de>
Date: Thu, 3 May 2018 15:35:23 +0200
Subject: [PATCH] add HTTP/2 for apache

---
 server/conf/vhost.conf.master                   |  9 +++++++++
 server/plugins-available/apache2_plugin.inc.php | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 2ec0e153e0..de3bda1dbd 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -37,6 +37,15 @@
 </tmpl_if>
 		ServerAdmin webmaster@<tmpl_var name='domain'>
 
+<tmpl_if name='ssl_enabled'>
+<tmpl_if name='enable_http2' op='==' value='y'>
+		Protocols h2 http/1.1
+		SSLProtocol All -SSLv2 -SSLv3
+		SSLCipherSuite 'EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !M
+D5 !EXP !PSK !SRP !DSS'
+</tmpl_if>
+</tmpl_if>
+
 		ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
 
 <tmpl_if name='errordocs'>
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 95cdefd214..25e1a4514b 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1214,6 +1214,17 @@ class apache2_plugin {
 
 		if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
 
+		// HTTP/2.0 ?
+		$vhost_data['enable_http2']  = 'n';
+		if($vhost_data['enable_spdy'] == 'y'){
+			// check if apache supports http_v2
+			exec("2>&1 apachectl -M | grep http2_module", $tmp_output, $tmp_retval);
+			if($tmp_retval == 0){
+				$vhost_data['enable_http2']  = 'y';
+			}
+			unset($tmp_output, $tmp_retval);
+		}
+
 		// Set SEO Redirect
 		if($data['new']['seo_redirect'] != ''){
 			$vhost_data['seo_redirect_enabled'] = 1;
-- 
GitLab