From d228f303e2fb219c76c87c128a6c1d7b92f44d3e Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Fri, 27 May 2016 10:46:30 -0400
Subject: [PATCH] - changed approach for nginx + letsencrypt

---
 interface/web/sites/web_vhost_domain_edit.php |    4 +++-
 install/tpl/nginx_ispconfig.vhost.master      |    7 -------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/install/tpl/nginx_ispconfig.vhost.master b/install/tpl/nginx_ispconfig.vhost.master
index d5531ab..8498770 100644
--- a/install/tpl/nginx_ispconfig.vhost.master
+++ b/install/tpl/nginx_ispconfig.vhost.master
@@ -1,11 +1,4 @@
 server {
-	location ~ /\.well-known/acme-challenge/ {
-		root /usr/local/ispconfig/interface/acme/;
-		index index.html index.htm;
-		try_files $uri =404;
-	}
-}
-server {
         listen {vhost_port};
         listen [::]:{vhost_port} ipv6only=on;
 		ssl {ssl_on};
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index a007e31..c166660 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -1340,8 +1340,9 @@
 		
 		// Letsencrypt can not be activated before the website has been created
 		// So we deactivate it here and add a datalog update in onAfterInsert
-		if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y') {
+		if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y' && isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y') {
 			$this->dataRecord['ssl_letsencrypt'] = 'n';
+			$this->dataRecord['ssl'] = 'n';
 			$this->_letsencrypt_on_insert = true;
 		}
 	}
@@ -1421,6 +1422,7 @@
 		if($this->_letsencrypt_on_insert == true) {
 			$tmp = $web_rec;
 			$tmp['ssl_letsencrypt'] = 'y';
+			$tmp['ssl'] = 'y';
 			$app->db->datalogUpdate('web_domain', $tmp, 'domain_id', $this->id);
 			unset($tmp);
 		}

--
Gitblit v1.9.1