]> git.ekhem.eu.org Git - gym.git/commitdiff
Serve scripts for interacting with the database through nginx.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 17 Dec 2023 21:18:44 +0000 (22:18 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 31 Dec 2023 11:01:01 +0000 (12:01 +0100)
gym.conf [new file with mode: 0644]

diff --git a/gym.conf b/gym.conf
new file mode 100644 (file)
index 0000000..da5ba1f
--- /dev/null
+++ b/gym.conf
@@ -0,0 +1,52 @@
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# 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;
+}