Add parked alias domains with Arvan or Cloudflare DNS and websites SSL.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
5813e9fc53
commit
d1f60b5313
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Remove a parked-alias nginx site. Does not delete Arvan DNS or LE certs.
|
||||
set -euo pipefail
|
||||
|
||||
HOST="${1:-}"
|
||||
|
||||
if [[ -z "$HOST" ]]; then
|
||||
echo "usage: unpark.sh <parked-host>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! "$HOST" =~ ^[a-z0-9.-]+$ ]]; then
|
||||
echo "invalid host" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NGINX_AVAILABLE="/etc/nginx/sites-available/$HOST"
|
||||
NGINX_ENABLED="/etc/nginx/sites-enabled/$HOST"
|
||||
LIST_FILE="/opt/websites-agent/parked-hosts.txt"
|
||||
|
||||
rm -f "$NGINX_ENABLED"
|
||||
rm -f "$NGINX_AVAILABLE"
|
||||
|
||||
if [[ -f "$LIST_FILE" ]]; then
|
||||
grep -vxF "$HOST" "$LIST_FILE" >"${LIST_FILE}.tmp" || true
|
||||
mv "${LIST_FILE}.tmp" "$LIST_FILE"
|
||||
fi
|
||||
|
||||
nginx -t
|
||||
systemctl reload nginx
|
||||
echo "unpark ok: $HOST"
|
||||
Reference in New Issue
Block a user