From 919f0fa13bdf92ce8672307a3dd5b888fb11e009 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sat, 28 Nov 2020 18:37:48 +0100 Subject: [PATCH] Added "api" server and HTTP/2 listeners Added servers for "api.victorwesterlund.com" along with an HTTP/2 listener for both 'api' and 'www'. Added ".well-known/" to gitignore --- .gitignore | 1 + server.conf | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e69de29..2ca62ca 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +.well-known/ \ No newline at end of file diff --git a/server.conf b/server.conf index 28fe5f8..da8a0c2 100644 --- a/server.conf +++ b/server.conf @@ -1,3 +1,5 @@ +# == victorwesterlund.com == + server { listen 80; listen [::]:80; @@ -8,8 +10,8 @@ server { } server { - listen 443 ssl; - listen [::]:443 ssl; + listen 443 ssl http2; + listen [::]:443 ssl http2; server_name www.victorwesterlund.com; @@ -33,3 +35,41 @@ server { return 404; } } + +# == api.victorwesterlund.com == + +server { + listen 80; + listen [::]:80; + + server_name api.victorwesterlund.com; + + return 301 https://api.victorwesterlund.com$request_uri; +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name api.victorwesterlund.com; + + ssl on; + include snippets/ssl.conf; + + root /var/www/github_victorwesterlund_victorwesterlund.com/api; + + location \ { + try_files $uri $uri.html $uri/ =404; + } + + location ~ \.php$ { + add_header Access-Control-Allow-Origin *; + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.3-fpm.sock; + } + + location ~ /\.git { + deny all; + return 404; + } +} \ No newline at end of file