This bash script is designed to remove a specified site from both Nginx sites-available and sites-enabled, and then delete the corresponding directory from /var/www
-
Make sure you have the necessary permissions to modify Nginx configurations and remove directories.
-
Make the script executable:
chmod +x cleanup.sh
-
Run the script with the sitename as an argument:
./cleanup.sh your_sitename
Replace your_sitename with the actual sitename you want to clean up.
This script will remove Nginx configuration files from both sites-available and sites-enabled, restart Nginx to apply changes, and then delete the corresponding web directory. Always double-check your sitename before running the script to avoid unintentional data loss.