From 0d61ff815ba0cd1c364e379dbfa0057b4a3afbe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szekeres=20Ba=CC=81lint?= Date: Sat, 21 Apr 2018 15:47:37 +0200 Subject: [PATCH] index, fallback refactor --- public/assets/js/app.js | 19 ++++--- public/index.html | 59 +++++++++++---------- public/templates/conf/_php.conf.html | 4 +- public/templates/conf/example.com.conf.html | 22 ++++---- 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/public/assets/js/app.js b/public/assets/js/app.js index a14180b..2a5f97a 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -48,11 +48,10 @@ non_www: true, cdn: false, - index: '', - index_html: false, + index: 'index.php', + fallback: true, php: '7.2', - index_php: true, wordpress: false, file_structure: 'unified', @@ -343,17 +342,21 @@ }; $scope.isIndexHtml = function() { - return $scope.data.index_html; + return $scope.data.index === 'index.html'; + }; + + $scope.isIndexPhp = function() { + return $scope.isPHP() && $scope.data.index === 'index.php'; + }; + + $scope.isFallback = function() { + return $scope.data.fallback && (!$scope.isIndexPhp() || $scope.isPHP); }; $scope.isPHP = function() { return $scope.data.php !== 'off'; }; - $scope.isIndexPhp = function() { - return $scope.isPHP() && $scope.data.index_php; - }; - $scope.isWordPress = function() { return $scope.isPHP() && $scope.data.wordpress; }; diff --git a/public/index.html b/public/index.html index f508207..ae8b483 100644 --- a/public/index.html +++ b/public/index.html @@ -186,18 +186,27 @@
-
- - + +
+
+ + +
-
- - +
+
+ + +
+
+
+
+
@@ -214,14 +223,6 @@
-
-
- - -
-
@@ -234,23 +235,25 @@
- +
- - + +
-
+
- - + +
+
+ + +
diff --git a/public/templates/conf/_php.conf.html b/public/templates/conf/_php.conf.html index a2f3e7e..b606a86 100644 --- a/public/templates/conf/_php.conf.html +++ b/public/templates/conf/_php.conf.html @@ -1,6 +1,6 @@ # index -index {{ isIndexHtml() ? 'index.html ' : '' }}index.php; + ✔ modularized && ✔ index.php --># index.php +index index.php; listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}80; + ✔ IPv6 --> listen [{{ data.ipv6 }}]:80; listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}443 ssl{{ isHTTP2() ? ' http2' : '' }}; + ✔ IPv6 --> listen [{{ data.ipv6 }}]:443 ssl{{ isHTTP2() ? ' http2' : '' }}; server_name {{ isWWW() ? 'www.' : '' }}{{ domain() }}; - root /var/www/{{ domain() }}{{ data.document_root }}; + root /var/www/{{ domain() }}{{ data.document_root }}; + + # index.php + index index.php; @@ -32,16 +35,11 @@ server { ssl_trusted_certificate /etc/letsencrypt/live/{{ domain() }}/fullchain.pem; + ✔ fallback --> - # index - index {{ isIndexHtml() ? 'index.html ' : '' }}index.php; - - # $uri{{ isIndexHtml() ? ', index.html' : '' }}{{ isIndexPhp() ? ', index.php' : '' }} + # $uri{{ isFallback() ? (', ' + data.index) : '' }} location / { - try_files $uri $uri/ {{ isIndexHtml() ? '/index.html' : '' }}{{ isIndexHtml() && isIndexPhp() ? ' ' : '' }}{{ isIndexPhp() ? '/index.php?$query_string' : '' }}; + try_files $uri $uri/ {{ isIndexHtml() ? '/index.html' : '' }}{{ isIndexPhp() ? '/index.php?$query_string' : '' }}; }