]> git.ekhem.eu.org Git - metrics.git/commitdiff
Serve scripts for interacting with the database through nginx.
authorJakub Czajka <jakub@ekhem.eu.org>
Tue, 2 Jan 2024 12:00:01 +0000 (13:00 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Tue, 2 Jan 2024 12:00:01 +0000 (13:00 +0100)
metrics.conf [new file with mode: 0644]

diff --git a/metrics.conf b/metrics.conf
new file mode 100644 (file)
index 0000000..d66393d
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright (c) 2024 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+server {
+    server_name  metrics.${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}/metrics;
+
+    location ~ ^/sleep {
+        include fastcgi_params;
+        fastcgi_pass unix:/var/run/fcgiwrap.socket;
+        fastcgi_param REQUEST_BODY ${dollar}request_body;
+        fastcgi_param SCRIPT_FILENAME ${dollar}document_root/sleep.sh;
+    }
+
+    location = / {
+        include fastcgi_params;
+        fastcgi_pass unix:/var/run/fcgiwrap.socket;
+        fastcgi_param SCRIPT_FILENAME ${dollar}document_root/metrics.sh;
+    }
+}
+
+server {
+    server_name  metrics.${private_domain};
+
+    listen       [::]:80;
+    listen       80;
+
+    if (${dollar}host = metrics.${private_domain}) {
+        return 301 https://${dollar}host${dollar}request_uri;
+    }
+
+    return 404;
+}