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"