Skip to content

Instantly share code, notes, and snippets.

@rajeshisnepali
Created November 25, 2018 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeshisnepali/5cc7820d17c9fbfccd03683063878fc1 to your computer and use it in GitHub Desktop.
Save rajeshisnepali/5cc7820d17c9fbfccd03683063878fc1 to your computer and use it in GitHub Desktop.
This script remove server blocks [nginx]
#!/bin/bash
# to be able to work this function globally, copy or create link in /usr/local/bin
# remove domain if found
sudo sed -i '/'$1'/d' /etc/hosts
# remove sites-available & sites-enabled if found
file=$1
if [ -f /etc/nginx/sites-available/$file ] ; then
sudo rm /etc/nginx/sites-available/$file
sudo rm /etc/nginx/sites-enabled/$file
fi
echo success: domain $file is removed successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment