lecoffre-back-mini/scripts/nginx_cleanup_local4nk.sh
NicolasCantu 235be939af
All checks were successful
Build and Push to Registry / build-and-push (push) Successful in 51s
chore(scripts): add nginx cleanup for local.4nkweb.com vhost and .bak
2025-09-24 18:48:15 +02:00

23 lines
706 B
Bash
Executable File

#!/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"