From 18105979177272365fc83cdeef28271e9035d5ae Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Tue, 15 Sep 2020 15:24:20 +0200
Subject: [PATCH] - move apache vhost to conf file instead

---
 install/lib/installer_base.lib.php               | 16 ++++++++++------
 ...acme.vhost.master => apache_acme.conf.master} |  9 +--------
 2 files changed, 11 insertions(+), 14 deletions(-)
 rename install/tpl/{apache_acme.vhost.master => apache_acme.conf.master} (65%)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index a4e7b4b6d8..0af5104d06 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -2723,9 +2723,13 @@ class installer_base {
 	private function make_acme_vhost($server_name, $server = 'apache') {
 		global $conf;
 
-		$use_template = 'apache_acme.vhost.master';
+		$use_template = 'apache_acme.conf.master';
+		$use_symlink = '999-acme.conf';
+		$use_name = 'acme.conf';
 		if($server === 'nginx') {
 			$use_template = 'nginx_acme.vhost.master';
+			$use_symlink = '999-acme.vhost';
+			$use_name = 'acme.vhost';
 		}
 
 		$vhost_conf_dir = $conf[$server]['vhost_conf_dir'];
@@ -2746,13 +2750,13 @@ class installer_base {
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 
-		wf($vhost_conf_dir.'/acme.vhost', $tpl->grab());
+		wf($vhost_conf_dir.'/' . $use_name, $tpl->grab());
 
-		if(@is_link($vhost_conf_enabled_dir.'/999-acme.vhost')) {
-			unlink($vhost_conf_enabled_dir.'/999-acme.vhost');
+		if(@is_link($vhost_conf_enabled_dir.'/' . $use_symlink)) {
+			unlink($vhost_conf_enabled_dir.'/' . $use_symlink);
 		}
-		if(!@is_link($vhost_conf_enabled_dir.'/999-acme.vhost')) {
-			symlink($vhost_conf_dir.'/acme.vhost', $vhost_conf_enabled_dir.'/999-acme.vhost');
+		if(!@is_link($vhost_conf_enabled_dir.'' . $use_symlink)) {
+			symlink($vhost_conf_dir.'/' . $use_name, $vhost_conf_enabled_dir.'/' . $use_symlink);
 		}
 
 		if($conf[$server]['installed'] == true && $conf[$server]['init_script'] != '') {
diff --git a/install/tpl/apache_acme.vhost.master b/install/tpl/apache_acme.conf.master
similarity index 65%
rename from install/tpl/apache_acme.vhost.master
rename to install/tpl/apache_acme.conf.master
index 59ece91c00..4a16294335 100644
--- a/install/tpl/apache_acme.vhost.master
+++ b/install/tpl/apache_acme.conf.master
@@ -1,8 +1,4 @@
-<VirtualHost *:80>
-
-	ServerName <tmpl_var name='domain'>
-	
-	DocumentRoot /usr/local/ispconfig/interface/acme
+	Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
 
 	<Directory /usr/local/ispconfig/interface/acme>
 		AllowOverride None
@@ -13,6 +9,3 @@
 		Allow from all
 		</tmpl_if>
 	</Directory>
-
-</VirtualHost>
-
-- 
GitLab