← back to Japan Enrich
japan: rewrite nginx setup — separate conf via scp (server_name built by loop, not buggy sed); nginx -t gates reload, one certbot --expand for all 19
32cb9e4dfac9424c4ff81d15a3b3324647819a20 · 2026-07-06 17:32:01 -0700 · Steve
Files touched
M scripts/nginx-distributor-setup.sh
Diff
commit 32cb9e4dfac9424c4ff81d15a3b3324647819a20
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Jul 6 17:32:01 2026 -0700
japan: rewrite nginx setup — separate conf via scp (server_name built by loop, not buggy sed); nginx -t gates reload, one certbot --expand for all 19
---
scripts/nginx-distributor-setup.sh | 40 +++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/scripts/nginx-distributor-setup.sh b/scripts/nginx-distributor-setup.sh
index dc1d1d7..fc02d25 100644
--- a/scripts/nginx-distributor-setup.sh
+++ b/scripts/nginx-distributor-setup.sh
@@ -1,26 +1,30 @@
#!/usr/bin/env bash
# Route the 19 distributor subdomains to the japan-viewer (:9934) on Kamatera + issue certs.
+# Writes a SEPARATE nginx conf (no fragile in-place edit of the existing japan block).
# Run under Steve: bash ~/Projects/japan-enrich/scripts/nginx-distributor-setup.sh
-# (SSHes to Kamatera; nginx edit + certbot need root there.)
set -euo pipefail
SUBS="j-josephson eijffinger omexco goodrich p3tec vahallan la-scala-milano zambaiti-parati \
carlise-co zintra versa-design-surfaces sangetsu greenland texam texdecor zambaiti \
koroseal-sg harlequin-sg cole-son-sg"
-DFLAGS=""; for s in $SUBS; do DFLAGS="$DFLAGS -d $s.designerwallcoverings.com"; done
+NAMES=""; DFLAGS=""
+for s in $SUBS; do NAMES="$NAMES $s.designerwallcoverings.com"; DFLAGS="$DFLAGS -d $s.designerwallcoverings.com"; done
-ssh root@45.61.58.125 bash -s <<EOF
-set -e
-# find the nginx conf that serves japan-viewer (matches 'japan.designerwallcoverings.com')
-CONF=\$(grep -rl 'japan.designerwallcoverings.com' /etc/nginx/sites-available/ /etc/nginx/sites-enabled/ 2>/dev/null | head -1)
-echo "nginx conf: \$CONF"
-[ -z "\$CONF" ] && { echo "!! japan-viewer nginx conf not found — add server_name manually"; exit 1; }
-cp "\$CONF" "\$CONF.bak-\$(date +%s)"
-# append the 19 names to the existing japan server_name line if not already present
-if ! grep -q 'koroseal-sg.designerwallcoverings.com' "\$CONF"; then
- sed -i "s/server_name japan.designerwallcoverings.com/server_name japan.designerwallcoverings.com $(echo $SUBS | sed 's/[a-z0-9-]*/&.designerwallcoverings.com/g')/" "\$CONF"
-fi
-nginx -t && systemctl reload nginx && echo "nginx reloaded"
-# issue certs for japan + all 19 in one run
-certbot --nginx --non-interactive --agree-tos -m steve@designerwallcoverings.com --expand \
- -d japan.designerwallcoverings.com $DFLAGS
-EOF
+# build the conf LOCALLY (nginx runtime vars escaped as \$; $NAMES expands here)
+cat > /tmp/distributor-microsites.conf <<CONF
+server {
+ listen 80;
+ server_name$NAMES;
+ client_max_body_size 12m;
+ location / {
+ proxy_pass http://127.0.0.1:9934;
+ proxy_set_header Host \$host;
+ proxy_set_header X-Real-IP \$remote_addr;
+ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto \$scheme;
+ }
+}
+CONF
+
+scp /tmp/distributor-microsites.conf root@45.61.58.125:/etc/nginx/sites-available/distributor-microsites
+ssh root@45.61.58.125 "ln -sf /etc/nginx/sites-available/distributor-microsites /etc/nginx/sites-enabled/distributor-microsites && nginx -t && systemctl reload nginx && echo 'nginx reloaded' && certbot --nginx --non-interactive --agree-tos -m steve@designerwallcoverings.com --expand$DFLAGS && echo 'certs issued'"
+echo "done — distributor subdomains should now serve behind admin/DW2024!"
← e82b903 japan: loader prefers dw_admin (owner) DSN so ALTER TABLE us
·
back to Japan Enrich
·
japan: loader ALTER safety — skip if use_for_ai exists (no l c9bf0f6 →