mirror of
https://github.com/digitalocean/nginxconfig.io.git
synced 2025-09-21 19:29:22 +08:00
forceHTTPS
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
https: false,
|
https: false,
|
||||||
http2: true,
|
http2: true,
|
||||||
|
|
||||||
|
force_https: true,
|
||||||
|
|
||||||
cert_type: 'letsencrypt',
|
cert_type: 'letsencrypt',
|
||||||
email: '',
|
email: '',
|
||||||
ssl_certificate: '',
|
ssl_certificate: '',
|
||||||
@@ -270,6 +272,10 @@
|
|||||||
return $scope.isHTTPS() && $scope.data.http2;
|
return $scope.isHTTPS() && $scope.data.http2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.isForceHTTPS = function() {
|
||||||
|
return $scope.isHTTPS() && $scope.data.force_https;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.isLetsEncrypt = function() {
|
$scope.isLetsEncrypt = function() {
|
||||||
return $scope.isHTTPS() && $scope.data.cert_type === 'letsencrypt';
|
return $scope.isHTTPS() && $scope.data.cert_type === 'letsencrypt';
|
||||||
};
|
};
|
||||||
|
@@ -84,6 +84,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-subgroup" ng-if="isHTTPS()" ng-cloak>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="force_https" ng-model="data.force_https">
|
||||||
|
<label class="form-check-label" for="force_https">
|
||||||
|
<span tooltips tooltip-template="Force redirection from HTTP to HTTPS.">force HTTPS</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-subgroup" ng-if="isHTTPS()" ng-cloak>
|
<div class="form-subgroup" ng-if="isHTTPS()" ng-cloak>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" id="letsencrypt" ng-model="data.cert_type" value="letsencrypt">
|
<input class="form-check-input" type="radio" id="letsencrypt" ng-model="data.cert_type" value="letsencrypt">
|
||||||
|
@@ -1,8 +1,16 @@
|
|||||||
server {
|
server {<!--
|
||||||
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};<!--
|
|
||||||
|
✘ HTTPS || ✘ forceHTTPS --><span ng-if="!isHTTPS() || !isForceHTTPS()">
|
||||||
|
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}80;<!--
|
||||||
|
|
||||||
✔ IPv6 --><span ng-if="isIPv6()">
|
✔ IPv6 --><span ng-if="isIPv6()">
|
||||||
listen [{{ data.ipv6 }}]:{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};</span>
|
listen [{{ data.ipv6 }}]:80;</span></span><!--
|
||||||
|
|
||||||
|
✔ HTTPS --><span ng-if="isHTTPS()">
|
||||||
|
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}443 ssl{{ isHTTP2() ? ' http2' : '' }};<!--
|
||||||
|
|
||||||
|
✔ IPv6 --><span ng-if="isIPv6()">
|
||||||
|
listen [{{ data.ipv6 }}]:443 ssl{{ isHTTP2() ? ' http2' : '' }};</span></span>
|
||||||
|
|
||||||
server_name {{ isWWW() ? 'www.' : '' }}{{ domain() }};<!--
|
server_name {{ isWWW() ? 'www.' : '' }}{{ domain() }};<!--
|
||||||
|
|
||||||
@@ -145,7 +153,7 @@ server {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
✔ HTTPS --><span ng-if="isHTTPS()">
|
✔ forceHTTPS --><span ng-if="isForceHTTPS()">
|
||||||
|
|
||||||
# HTTP redirect
|
# HTTP redirect
|
||||||
server {
|
server {
|
||||||
|
Reference in New Issue
Block a user