fallback refactor
parent
3712ab8045
commit
11260d7ea5
|
@ -49,7 +49,9 @@
|
||||||
cdn: false,
|
cdn: false,
|
||||||
|
|
||||||
index: 'index.php',
|
index: 'index.php',
|
||||||
fallback: true,
|
fallback_html: false,
|
||||||
|
fallback_php: true,
|
||||||
|
fallback_php_path: '/api/',
|
||||||
|
|
||||||
php: '7.2',
|
php: '7.2',
|
||||||
wordpress: false,
|
wordpress: false,
|
||||||
|
@ -341,16 +343,20 @@
|
||||||
return $scope.isWWW() && $scope.data.cdn;
|
return $scope.isWWW() && $scope.data.cdn;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isIndexHtml = function() {
|
$scope.isIndexHTML = function() {
|
||||||
return $scope.data.index === 'index.html';
|
return $scope.data.index === 'index.html' || !$scope.isPHP();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isIndexPhp = function() {
|
$scope.isIndexPHP = function() {
|
||||||
return $scope.isPHP() && $scope.data.index === 'index.php';
|
return $scope.isPHP() && $scope.data.index === 'index.php';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isFallback = function() {
|
$scope.isFallbackHTML = function() {
|
||||||
return $scope.data.fallback && (!$scope.isIndexPhp() || $scope.isPHP);
|
return $scope.data.fallback_html;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.isFallbackPHP = function() {
|
||||||
|
return $scope.data.fallback_php && $scope.isPHP();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isPHP = function() {
|
$scope.isPHP = function() {
|
||||||
|
|
|
@ -235,7 +235,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<label class="form-label"><code tooltips tooltip-template="Defines the file that will be used as an index, optionally configures fallback of unhandled requests.">index</code></label>
|
<label class="form-label"><code tooltips tooltip-template="Defines the file that will be used as an index.">index</code></label>
|
||||||
<div class="form-subgroup">
|
<div class="form-subgroup">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" id="index.html" ng-model="data.index" value="index.html">
|
<input class="form-check-input" type="radio" id="index.html" ng-model="data.index" value="index.html">
|
||||||
|
@ -248,11 +248,22 @@
|
||||||
<label class="form-check-label" for="index.php">index.php</label>
|
<label class="form-check-label" for="index.php">index.php</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check mt-2">
|
|
||||||
<input class="form-check-input" type="checkbox" id="fallback" ng-model="data.fallback">
|
<label class="form-label mt-3"><span tooltips tooltip-template="Configures fallback routing of unhandled requests.">fallback routing</span></label>
|
||||||
<label class="form-check-label" for="fallback">
|
<div class="form-subgroup">
|
||||||
<span tooltips tooltip-template="Fallback of unhandled requests.">fallback <small>({{ isIndexPhp() ? 'index.php' : 'index.html' }})</small></span>
|
<div class="form-check">
|
||||||
</label>
|
<input class="form-check-input" type="checkbox" id="fallback_html" ng-model="data.fallback_html">
|
||||||
|
<label class="form-check-label" for="fallback_html">index.html</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check" ng-if="isPHP()">
|
||||||
|
<input class="form-check-input" type="checkbox" id="fallback_php" ng-model="data.fallback_php">
|
||||||
|
<label class="form-check-label" for="fallback_php">index.php</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-subgroup" ng-if="isFallbackHTML() && isFallbackPHP()">
|
||||||
|
<div class="form-group pl-1">
|
||||||
|
<input type="text" class="form-control form-control-sm" ng-model="data.fallback_php_path">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -389,7 +400,7 @@
|
||||||
<div class="col-md-6 col-lg-7 files">
|
<div class="col-md-6 col-lg-7 files">
|
||||||
<div class="row grid">
|
<div class="row grid">
|
||||||
<div class="grid-sizer col-xl-6"></div>
|
<div class="grid-sizer col-xl-6"></div>
|
||||||
<div ng-if="(isHTTPS() && (isCertLetsEncrypt() || !isSSLProfileModern())) || isWordPress()" class="grid-item col-xl-12" ng-cloak>
|
<div ng-if="(isHTTPS() && (isCertLetsEncrypt() || !isSSLProfileModern()))" class="grid-item col-xl-12" ng-cloak>
|
||||||
<div class="commands">
|
<div class="commands">
|
||||||
<pre><code class="hljs bash" ng-include="'templates/commands.html?v=COMMIT_HASH'"></code></pre>
|
<pre><code class="hljs bash" ng-include="'templates/commands.html?v=COMMIT_HASH'"></code></pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -434,16 +445,6 @@
|
||||||
<pre><code class="nginx" ng-include="'templates/conf/_general.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></code></pre>
|
<pre><code class="nginx" ng-include="'templates/conf/_general.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></code></pre>
|
||||||
</div><div id="file-general" class="code highlighted"></div>
|
</div><div id="file-general" class="code highlighted"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-6 grid-item file" ng-if="isPHP() && isModularized()" ng-cloak>
|
|
||||||
<strong>/etc/nginx/_php.conf</strong>
|
|
||||||
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-php" ngclipboard-success="clipboardSuccess('_php.conf')">
|
|
||||||
<img src="assets/img/clipboard-dark.svg" alt="Copy to clipboard">
|
|
||||||
</button>
|
|
||||||
<span class="clipboard-success" ng-if="clipboardCopy === '_php.conf'">Copied!</span>
|
|
||||||
<div class="code source"data-filename="_php.conf">
|
|
||||||
<pre><code class="nginx" ng-include="'templates/conf/_php.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></code></pre>
|
|
||||||
</div><div id="file-php" class="code highlighted"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xl-6 grid-item file" ng-if="isPHP() && (isModularized() || isWordPress())" ng-cloak>
|
<div class="col-xl-6 grid-item file" ng-if="isPHP() && (isModularized() || isWordPress())" ng-cloak>
|
||||||
<strong>/etc/nginx/_php_fastcgi.conf</strong>
|
<strong>/etc/nginx/_php_fastcgi.conf</strong>
|
||||||
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-php_fastcgi" ngclipboard-success="clipboardSuccess('_php_fastcgi.conf')">
|
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-php_fastcgi" ngclipboard-success="clipboardSuccess('_php_fastcgi.conf')">
|
||||||
|
|
|
@ -25,15 +25,4 @@
|
||||||
--><span class="hljs-attribute">--agree-tos</span> <!--
|
--><span class="hljs-attribute">--agree-tos</span> <!--
|
||||||
--><span class="hljs-attribute">--force-renewal</span><!--
|
--><span class="hljs-attribute">--force-renewal</span><!--
|
||||||
|
|
||||||
--></span><!--
|
--></span>
|
||||||
|
|
||||||
|
|
||||||
โ HTTPS && โ WordPress --><span ng-if="isHTTPS() && isWordPress()">
|
|
||||||
|
|
||||||
</span><!--
|
|
||||||
|
|
||||||
|
|
||||||
โ WordPress --><span ng-if="isWordPress()"><!--
|
|
||||||
|
|
||||||
--><span class="hljs-comment"># <strong>WordPress</strong>: add to <strong>wp-config.php</strong> <small>(<a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6389" target="_blank">CVE-2018-6389</a>)</small></span>
|
|
||||||
<span class="hljs-section">define(<span class="hljs-string">'CONCATENATE_SCRIPTS'</span>, <span class="hljs-literal">false</span>);</span></span>
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<!--
|
|
||||||
โ modularized && โ index.php --><span ng-if="isModularized() && isIndexPhp()"># index.php
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
</span><!--
|
|
||||||
|
|
||||||
--># handle .php
|
|
||||||
location ~ \.php$ {<!--
|
|
||||||
โ modularized || โ WordPress --><span ng-if="isModularized() || isWordPress()">
|
|
||||||
include _php_fastcgi.conf;</span><!--
|
|
||||||
|
|
||||||
โ unified && โ WordPress --><span ng-if="isUnified() && !isWordPress()">
|
|
||||||
<ng-include ng-include-tabs="{{ isUnified() ? 3 : 1 }}" src="'templates/conf/_php_fastcgi.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
|
|
||||||
}
|
|
|
@ -21,7 +21,7 @@ server {<!--
|
||||||
โ PHP --><span ng-if="!isPHP()">
|
โ PHP --><span ng-if="!isPHP()">
|
||||||
root /var/www/{{ domain() }}{{ data.document_root }};</span><!--
|
root /var/www/{{ domain() }}{{ data.document_root }};</span><!--
|
||||||
|
|
||||||
โ unified && โ index.php --><span ng-if="isUnified() && isIndexPhp()">
|
โ index.php --><span ng-if="isIndexPHP()">
|
||||||
|
|
||||||
# index.php
|
# index.php
|
||||||
index index.php;</span><!--
|
index index.php;</span><!--
|
||||||
|
@ -35,11 +35,30 @@ server {<!--
|
||||||
โ Let's Encrypt --><span ng-if="isCertLetsEncrypt()">
|
โ Let's Encrypt --><span ng-if="isCertLetsEncrypt()">
|
||||||
ssl_trusted_certificate /etc/letsencrypt/live/{{ domain() }}/fullchain.pem;</span></span><!--
|
ssl_trusted_certificate /etc/letsencrypt/live/{{ domain() }}/fullchain.pem;</span></span><!--
|
||||||
|
|
||||||
โ fallback --><span ng-if="isFallback()">
|
โ Fallback HTML || โ Fallback PHP --><span ng-if="isFallbackHTML() || isFallbackPHP()">
|
||||||
|
|
||||||
# $uri{{ isFallback() ? (', ' + data.index) : '' }}
|
# {{ isFallbackHTML() ? 'index.html' : ( isFallbackPHP() ? 'index.php' : '' ) }} fallback
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ {{ isIndexHtml() ? '/index.html' : '' }}{{ isIndexPhp() ? '/index.php?$query_string' : '' }};
|
try_files $uri $uri/ {{ isFallbackHTML() ? '/index.html' : ( isFallbackPHP() ? '/index.php?$query_string' : '' ) }};
|
||||||
|
}</span><!--
|
||||||
|
|
||||||
|
โ Fallback HTML && โ Fallback PHP --><span ng-if="isFallbackHTML() && isFallbackPHP()">
|
||||||
|
|
||||||
|
# index.php fallback
|
||||||
|
location ~ ^{{ data.fallback_php_path }} {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}</span><!--
|
||||||
|
|
||||||
|
โ PHP --><span ng-if="isPHP()">
|
||||||
|
|
||||||
|
# handle .php
|
||||||
|
location ~ \.php$ {<!--
|
||||||
|
|
||||||
|
โ modularized || โ WordPress --><span ng-if="isModularized() || isWordPress()">
|
||||||
|
include _php_fastcgi.conf;</span><!--
|
||||||
|
|
||||||
|
โ unified && โ WordPress --><span ng-if="isUnified() && !isWordPress()">
|
||||||
|
<ng-include ng-include-tabs="{{ isUnified() ? 3 : 1 }}" src="'templates/conf/_php_fastcgi.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
|
||||||
}</span><!--
|
}</span><!--
|
||||||
|
|
||||||
โ unified --><span ng-if="isModularized()">
|
โ unified --><span ng-if="isModularized()">
|
||||||
|
@ -53,9 +72,6 @@ server {<!--
|
||||||
โ modularized && โ WordPress --><span ng-if="isModularized() && isWordPress()">
|
โ modularized && โ WordPress --><span ng-if="isModularized() && isWordPress()">
|
||||||
include _wordpress.conf;</span><!--
|
include _wordpress.conf;</span><!--
|
||||||
|
|
||||||
โ modularized && โ PHP --><span ng-if="isModularized() && isPHP()">
|
|
||||||
include _php.conf;</span><!--
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
โ unified --><span ng-if="isUnified()">
|
โ unified --><span ng-if="isUnified()">
|
||||||
|
@ -64,11 +80,7 @@ server {<!--
|
||||||
|
|
||||||
โ unified && โ WordPress --><span ng-if="isUnified() && isWordPress()">
|
โ unified && โ WordPress --><span ng-if="isUnified() && isWordPress()">
|
||||||
|
|
||||||
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/_wordpress.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span><!--
|
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/_wordpress.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
|
||||||
|
|
||||||
โ modularized && โ PHP --><span ng-if="isUnified() && isPHP()">
|
|
||||||
|
|
||||||
<!-- --><ng-include ng-include-tabs="2" src="'templates/conf/_php.conf.html?v=COMMIT_HASH'" onload="refreshHighlighting()"></ng-include></span>
|
|
||||||
}<!--
|
}<!--
|
||||||
|
|
||||||
|
|
||||||
|
|
Loadingโฆ
Reference in New Issue