Last active
June 22, 2018 10:37
-
-
Save ssmulders/1ee6e3f6a63ed7f9402c1471666bba26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Delete vhost / site from nginx on macOS | |
DOMAIN=$1 | |
SITES_AVAILABLE="/usr/local/etc/nginx/sites-available" | |
SITES_ENABLED="/usr/local/etc/nginx/sites-enabled" | |
read -p "Are you sure you want to delete $DOMAIN? " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
echo "Removing $DOMAIN from Nginx" | |
rm -rf $SITES_AVAILABLE/$DOMAIN | |
rm -rf $SITES_ENABLED/$DOMAIN | |
rm -rf /Users/stan/Dropbox/_LocalServer/$DOMAIN | |
sudo nginx -s reload | |
awk '!/'$DOMAIN'/' /etc/hosts > temp && sudo mv temp /etc/hosts | |
fi | |
echo "All done! $DOMAIN is a goner.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment