about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-12-01 10:31:18 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-12-01 10:31:18 +0000
commit3a5a0b088b6b5ee9d3f6501582dcffc3eb5ed83a (patch)
tree38f98966556958a30f7389e29af17ae13de9e565
parent2b144b691b79206ef5d4f8a0ae39c5baaddd2ea2 (diff)
downloadgenenetwork4-3a5a0b088b6b5ee9d3f6501582dcffc3eb5ed83a.tar.gz
nginx: document the vhost as it is actually deployed
The change went in by hand on vesuvio: same location block, three-space
indent, comments trimmed, and the connection-cap zone declared in the http
block (/etc/nginx/nginx.conf line 43) rather than beside the location as this
file had it. This file now matches what runs, with a note saying where the
zone lives and what a host installing it elsewhere has to add -- because
installing the previous version on this box would have failed `nginx -t' on a
duplicate zone.

Verified against the live server: / holds the connection until the client
gives up (curl exit 28, no headers), six concurrent requests from one address
give four held and two immediate 503s, and /gn4/version answers 200 in 56 ms
through the proxy throughout.
-rw-r--r--etc/nginx-vesuvio.pu.ac.ke.conf44
1 files changed, 17 insertions, 27 deletions
diff --git a/etc/nginx-vesuvio.pu.ac.ke.conf b/etc/nginx-vesuvio.pu.ac.ke.conf
index c8b24ea..b29208a 100644
--- a/etc/nginx-vesuvio.pu.ac.ke.conf
+++ b/etc/nginx-vesuvio.pu.ac.ke.conf
@@ -6,14 +6,16 @@ log_format gn4 '$remote_addr - $remote_user [$time_local] "$request" '
                'user=$upstream_http_x_gn4_user '
                'ua="$http_user_agent"';
 
+# The root location holds a request open (limit_conn below caps how many), and
+# its zone is declared in the http block: on vesuvio that is line 43 of
+# /etc/nginx/nginx.conf --
+#   limit_conn_zone $binary_remote_addr zone=gn4_root:1m;
+# A host installing this file without that line must add it, or `nginx -t'
+# fails on the unknown zone; adding it twice is a duplicate-zone error.
+#
 # Uncomment with the limit_req line inside the location below.
 # limit_req_zone $binary_remote_addr zone=gn4_per_ip:10m rate=20r/s;
 
-# The root location holds a request open (see `location = /` in the server
-# block), and a held request costs a socket: cap it per address so a scanner
-# cannot park threads on it. 1m of zone is roughly 32k addresses.
-limit_conn_zone $binary_remote_addr zone=gn4_root:1m;
-
 # nginx: https://vesuvio.pu.ac.ke/gn4/ -> genenetwork4 on 127.0.0.1:3000
 #
 # Drop into /etc/nginx/conf.d/ (included from inside nginx's http block) or
@@ -72,29 +74,17 @@ server {
     access_log /var/log/nginx/gn4.access.log gn4;
     error_log  /var/log/nginx/gn4.error.log;
 
-    # The bare host answers nothing at all. /gn4/ is the interface; a visit to
-    # the hostname is not an invitation to look around, and a "Hello, world!"
-    # at the root is an invitation to start probing.
-    #
-    # The request is held open rather than refused: no page, no redirect, no
-    # status line to report. proxy_pass points at TEST-NET-1 (RFC 5737), which
-    # is never routed, so the connection attempt goes nowhere and the visitor's
-    # browser gives up first (the 300s timeouts are the backstop, not the
-    # intent).
-    #
-    # `return 444' is the cheaper, conventional way to say the same thing: it
-    # closes the connection with no reply, which a client reports immediately
-    # as an empty reply instead of waiting. Use it if holding sockets ever
-    # becomes a problem; limit_conn below is what keeps that bounded today.
+    # Bare host: send people to the mount point rather than the catch-all
+    # 404 below. Drop this if the host root should stay empty.
     location = / {
-        proxy_pass http://192.0.2.1:9;
-        proxy_connect_timeout 300s;
-        proxy_read_timeout    300s;
-        proxy_send_timeout    300s;
-        proxy_next_upstream   off;
-        limit_conn gn4_root 4;
-        access_log off;
-        error_log /dev/null emerg;
+       proxy_pass http://192.0.2.1:9;      # TEST-NET-1 (RFC 5737): never routed
+       proxy_connect_timeout 300s;
+       proxy_read_timeout    300s;
+       proxy_send_timeout    300s;
+       proxy_next_upstream   off;
+       limit_conn gn4_root 4;
+       access_log off;
+       error_log /dev/null emerg;
     }
 
     location = /gn4 { return 301 /gn4/; }