From 6b72d8a722c59e3893fefb2e47ca517127ac3dba Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 25 Aug 2022 09:22:14 +0100 Subject: [PATCH] Revert "chore(nginx): simplify vhost configuration" This reverts commit c96c8be84c2920e1f75728aa5a9bdcb3f6f53948. --- nginx/oliverdavies.uk.conf | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/nginx/oliverdavies.uk.conf b/nginx/oliverdavies.uk.conf index 9fa3b7f2..08304551 100644 --- a/nginx/oliverdavies.uk.conf +++ b/nginx/oliverdavies.uk.conf @@ -394,7 +394,23 @@ map $uri $new_uri { } server { - listen 8080; + listen 80 default_server; + + server_name _; + + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name oliverdavies.uk; + ssl_certificate /home/opdavies/.acme.sh/www.oliverdavies.uk/www.oliverdavies.uk.cer; + ssl_certificate_key /home/opdavies/.acme.sh/www.oliverdavies.uk/www.oliverdavies.uk.key; + return 301 $scheme://www.oliverdavies.uk$request_uri; +} + +server { + listen 443 ssl; server_name www.oliverdavies.uk; root /srv/oliverdavies.uk; @@ -402,6 +418,9 @@ server { error_page 404 /404.html; + ssl_certificate /home/opdavies/.acme.sh/www.oliverdavies.uk/www.oliverdavies.uk.cer; + ssl_certificate_key /home/opdavies/.acme.sh/www.oliverdavies.uk/www.oliverdavies.uk.key; + location / { try_files $uri $uri.html $uri/index.html =404; }