Created
December 22, 2009 11:05
-
-
Save gnarargs/261673 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 | |
# sudo vhost dir domain | |
# $1 is the name of the directory in sites | |
# $2 is the domain to add to hosts file | |
# create a new site | |
if [ -d $HOME/Sites/$1 ] | |
then | |
echo "Site directory already exists, exiting" | |
exit 1 | |
else | |
mkdir $HOME/Sites/$1 | |
fi | |
# update hosts | |
echo -e "\n127.0.0.1 $2.dev" >> /etc/hosts | |
# update virtual hosts | |
echo -e "\n<VirtualHost *:80>\n\t DocumentRoot \"$HOME/Sites/$1\"\n\tServerName $2.dev\n\t</VirtualHost>" >> /etc/apache2/extra/httpd-vhosts.conf | |
# restart apache | |
apachectl restart | |
echo "Site successfully created" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment