From a95325c8ddd254eafaf3d8c66042d15dae6e6ca7 Mon Sep 17 00:00:00 2001 From: bpetschowitsch Date: Thu, 23 Apr 2026 16:48:29 +0200 Subject: [PATCH] Create 10_redirect_http_https.md --- 10_redirect_http_https.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 10_redirect_http_https.md diff --git a/10_redirect_http_https.md b/10_redirect_http_https.md new file mode 100644 index 0000000..fea61ed --- /dev/null +++ b/10_redirect_http_https.md @@ -0,0 +1,29 @@ +# Redirect http to https +to allow only encrypted connections, modify nginx site configuration like this: + +create a new server section like this: + +```nginx +server { + listen 80; + listen [::]:80; + + server_name *domain-name* + + return 308 https://$host$request_uri; +} + +remove the: +* listen 80; +* listen [::]:80; +statements from the live configuration: + +server { + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + + server_name * + + [...] +} +```