diff --git a/nginx/oliverdavies.uk.conf b/nginx/oliverdavies.uk.conf index 72b478b1..0d8a4618 100644 --- a/nginx/oliverdavies.uk.conf +++ b/nginx/oliverdavies.uk.conf @@ -391,12 +391,33 @@ 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; index index.html; 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; }