mirror of
				https://github.com/digitalocean/nginxconfig.io.git
				synced 2025-11-04 18:28:17 +08:00 
			
		
		
		
	forceHTTPS
This commit is contained in:
		@@ -35,6 +35,8 @@
 | 
			
		||||
			https:				false,
 | 
			
		||||
			http2:				true,
 | 
			
		||||
 | 
			
		||||
			force_https:		true,
 | 
			
		||||
 | 
			
		||||
			cert_type:			'letsencrypt',
 | 
			
		||||
			email:				'',
 | 
			
		||||
			ssl_certificate:	'',
 | 
			
		||||
@@ -270,6 +272,10 @@
 | 
			
		||||
			return $scope.isHTTPS() && $scope.data.http2;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		$scope.isForceHTTPS = function() {
 | 
			
		||||
			return $scope.isHTTPS() && $scope.data.force_https;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		$scope.isLetsEncrypt = function() {
 | 
			
		||||
			return $scope.isHTTPS() && $scope.data.cert_type === 'letsencrypt';
 | 
			
		||||
		};
 | 
			
		||||
 
 | 
			
		||||
@@ -84,6 +84,14 @@
 | 
			
		||||
										</label>
 | 
			
		||||
									</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-check">
 | 
			
		||||
										<input class="form-check-input" type="radio" id="letsencrypt" ng-model="data.cert_type" value="letsencrypt">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,16 @@
 | 
			
		||||
server {
 | 
			
		||||
	listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};<!--
 | 
			
		||||
server {<!--
 | 
			
		||||
 | 
			
		||||
	✔ IPv6 --><span ng-if="isIPv6()">
 | 
			
		||||
	listen [{{ data.ipv6 }}]:{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};</span>
 | 
			
		||||
	✘ HTTPS || ✘ forceHTTPS --><span ng-if="!isHTTPS() || !isForceHTTPS()">
 | 
			
		||||
	listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}80;<!--
 | 
			
		||||
 | 
			
		||||
		✔ IPv6 --><span ng-if="isIPv6()">
 | 
			
		||||
	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() }};<!--
 | 
			
		||||
 | 
			
		||||
@@ -145,7 +153,7 @@ server {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
✔ HTTPS --><span ng-if="isHTTPS()">
 | 
			
		||||
✔ forceHTTPS --><span ng-if="isForceHTTPS()">
 | 
			
		||||
 | 
			
		||||
# HTTP redirect
 | 
			
		||||
server {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user