From 82d727f9c0ef1499f3755516ced10172f1f0c1cd Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Sun, 17 Dec 2023 22:18:44 +0100 Subject: [PATCH] Serve scripts for interacting with the database through nginx. --- gym.conf | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 gym.conf diff --git a/gym.conf b/gym.conf new file mode 100644 index 0000000..da5ba1f --- /dev/null +++ b/gym.conf @@ -0,0 +1,52 @@ +# Copyright (c) 2023 Jakub Czajka +# License: GPL-3.0 or later. + +server { + server_name gym.${private_domain}; + + listen [::]:443 ssl http2; + listen 443 ssl http2; + + ssl_certificate ${private_ssl_cert_dir}/fullchain.pem; + ssl_certificate_key ${private_ssl_cert_dir}/privkey.pem; + + ssl_client_certificate ${ca_dir}/ca.pem; + ssl_verify_client on; + + root ${prod_dir}/gym; + + location ~ ^/record(.*) { + include fastcgi_params; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + fastcgi_param DATE ${dollar}arg_date; + fastcgi_param GYM ${dollar}arg_gym; + fastcgi_param SCRIPT_FILENAME ${dollar}document_root/record.sh; + } + + location ~ ^/(exercise|gym|workout)$ { + include fastcgi_params; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + fastcgi_param RECORD_TYPE ${dollar}1; + fastcgi_param REQUEST_BODY ${dollar}request_body; + fastcgi_param SCRIPT_FILENAME ${dollar}document_root/insert.sh; + } + + location = / { + include fastcgi_params; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + fastcgi_param SCRIPT_FILENAME ${dollar}document_root/gym.sh; + } +} + +server { + server_name gym.${private_domain}; + + listen [::]:80; + listen 80; + + if (${dollar}host = gym.${private_domain}) { + return 301 https://${dollar}host${dollar}request_uri; + } + + return 404; +} -- 2.39.5