From 235be939af2432e3e7e779edd7dda216fc8f42b6 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Wed, 24 Sep 2025 18:48:15 +0200 Subject: [PATCH] chore(scripts): add nginx cleanup for local.4nkweb.com vhost and .bak --- scripts/nginx_cleanup_local4nk.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/nginx_cleanup_local4nk.sh diff --git a/scripts/nginx_cleanup_local4nk.sh b/scripts/nginx_cleanup_local4nk.sh new file mode 100755 index 0000000..0b17383 --- /dev/null +++ b/scripts/nginx_cleanup_local4nk.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "[nginx-cleanup] Disabling local.4nkweb.com vhost and cleaning old files" + +TARGET_ENABLED="/etc/nginx/sites-enabled/local.4nkweb.com-3001" +TARGET_AVAILABLE_PREFIX="/etc/nginx/sites-available/local.4nkweb.com-3000" + +if [ -L "$TARGET_ENABLED" ] || [ -e "$TARGET_ENABLED" ]; then + echo "- Removing enabled vhost: $TARGET_ENABLED" + sudo rm -f "$TARGET_ENABLED" +else + echo "- Enabled vhost not present: $TARGET_ENABLED" +fi + +echo "- Removing available files: ${TARGET_AVAILABLE_PREFIX}*" +sudo rm -f ${TARGET_AVAILABLE_PREFIX}* || true + +echo "- Testing nginx configuration" +sudo nginx -t + +echo "[nginx-cleanup] Done. You can now reload: sudo systemctl reload nginx"