#!/usr/bin/env bash # Insert / update Meshkee SEO proxy locations on an existing storefront nginx site. # Covers: /sitemap.xml (index), /sitemap-main.xml, /sitemap-products.xml, /robots.txt set -euo pipefail HOST="${1:-}" API_HOST="${MESHKEE_API_HOST:-api.meshkee.com}" if [[ -z "$HOST" ]]; then echo "usage: patch-nginx-seo.sh " >&2 exit 1 fi NGINX_AVAILABLE="/etc/nginx/sites-available/$HOST" if [[ ! -f "$NGINX_AVAILABLE" ]]; then echo "missing nginx site for $HOST" >&2 exit 1 fi proxy_location() { local path="$1" local upstream="$2" cat <"$tmp" mv "$tmp" "$NGINX_AVAILABLE" echo "added: ${path}" } ensure_location /sitemap.xml sitemap.xml ensure_location /sitemap-main.xml sitemap-main.xml ensure_location /sitemap-products.xml sitemap-products.xml ensure_location /robots.txt robots.txt nginx -t systemctl reload nginx echo "patched nginx SEO locations for $HOST"