Add 8_Delete___all_the_changes_from_file_number_1_to_7.sh

This commit is contained in:
2025-11-22 19:34:39 +05:30
parent 116a270cbd
commit d117dd865d

View File

@@ -0,0 +1,46 @@
cat > undo_local_dns_nginx.sh << 'EOF'
#!/usr/bin/env bash
set -e
echo "==> 1) Stop & disable nginx"
sudo systemctl stop nginx || true
sudo systemctl disable nginx || true
echo "==> 2) Remove nginx configs created by local_dns scripts"
# HTTP reverse-proxy site
sudo rm -f /etc/nginx/sites-available/lan-proxy-web.conf
sudo rm -f /etc/nginx/sites-enabled/lan-proxy-web.conf
# Any HTTPS variant we may have made
sudo rm -f /etc/nginx/sites-available/lan-proxy-https.conf
sudo rm -f /etc/nginx/sites-enabled/lan-proxy-https.conf
# RustDesk stream config
sudo rm -f /etc/nginx/conf.d/rustdesk.conf
sudo rm -f /etc/nginx/conf.d/websocket_map.conf
sudo rm -rf /etc/nginx/streams-enabled
echo "==> 3) Clean /etc/hosts overrides for your domains"
sudo sed -i '/github.generalinfinity.cloud/d' /etc/hosts
sudo sed -i '/call.generalinfinity.cloud/d' /etc/hosts
sudo sed -i '/id.generalinfinity.cloud/d' /etc/hosts
sudo sed -i '/relay.generalinfinity.cloud/d' /etc/hosts
echo "==> 4) Remove UFW rules for RustDesk ports (ignore errors)"
for p in 21115 21116 21117 21118 21119; do
sudo ufw delete allow ${p}/tcp --force || true
done
for p in 21116 21117; do
sudo ufw delete allow ${p}/udp --force || true
done
sudo ufw reload || true
echo "==> 5) Purge nginx packages (this box will rely only on Caddy again)"
sudo apt-get -y purge nginx nginx-common libnginx-mod-stream || true
sudo apt-get -y autoremove --purge || true
echo "==> Done. If you want, reboot once: sudo reboot"
EOF
chmod +x undo_local_dns_nginx.sh
./undo_local_dns_nginx.sh