-
-
Save sohooo/109560 to your computer and use it in GitHub Desktop.
vhost script
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/sh | |
ME=soho | |
DIR=/Users/$ME/Sites/$1 | |
if [ ! -d $DIR ] | |
then | |
sudo -u $ME mkdir $DIR | |
sudo -u $ME touch $DIR/index.php | |
echo "<h1>$1</h1>" >> $DIR/index.php | |
fi | |
VHOST=/etc/apache2/extra/httpd-vhosts.conf | |
echo "\n<VirtualHost *:80>" >> $VHOST | |
echo "\tDocumentRoot \"$DIR\"" >> $VHOST | |
echo "\tServerName $1.dev" >> $VHOST | |
echo "</VirtualHost>\n" >> $VHOST | |
echo "127.0.0.1\t$1.dev" >> /etc/hosts | |
apachectl graceful | |
v $DIR # open VIM project | |
open http://$1.dev/ # open site in browser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment