-
-
Save jasonmelgoza/357082 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/sh | |
# Original script by Jason Tan: http://solutions.treypiepmeier.com/2009/03/03/virtual-hosts-on-osx-leopard/#comment-41787 | |
DIR=/Users/$SUDO_USER/Sites/$1 | |
if [[ ! -d $DIR && `id -u` -eq 0 ]]; then | |
echo "" | |
echo "Downloading site-template repository ..." | |
sudo -u $SUDO_USER git clone --quiet git://github.com/trey/site-template.git $DIR | |
cd $DIR | |
echo "Deleting unneeded parts ..." | |
rm -rf .git/ | |
rm .gitignore | |
mv html5.html index.html | |
rm html4.html | |
rm html4_lean.html | |
rm xhtml.html | |
rm xhtml_full.html | |
rm README.markdown | |
rm MIT-License.txt | |
mate $DIR | |
open http://127.0.0.1:8080/ | |
python -m SimpleHTTPServer 8080 | |
echo "" | |
echo "Done!" | |
else | |
echo "usage: sudo pyhost YOUR_PROJECT" | |
fi |
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 | |
# Original script by Jason Tan: http://solutions.treypiepmeier.com/2009/03/03/virtual-hosts-on-osx-leopard/#comment-41787 | |
DIR=/Users/$SUDO_USER/Sites/$1 | |
if [[ ! -d $DIR && `id -u` -eq 0 ]]; then | |
echo "" | |
echo "Downloading site-template repository ..." | |
sudo -u $SUDO_USER git clone --quiet git://github.com/trey/site-template.git $DIR | |
cd $DIR | |
echo "Deleting unneeded parts ..." | |
rm -rf .git/ | |
rm .gitignore | |
mv html5.html index.html | |
rm html4.html | |
rm html4_lean.html | |
rm xhtml.html | |
rm xhtml_full.html | |
rm README.markdown | |
rm MIT-License.txt | |
VHOST=/etc/apache2/users/$SUDO_USER.conf | |
echo "<VirtualHost *:80>" >> $VHOST | |
echo "\tDocumentRoot \"$DIR\"" >> $VHOST | |
echo "\tServerName $1.dev" >> $VHOST | |
echo "</VirtualHost>\n" >> $VHOST | |
echo "VirtualHost created in $VHOST ..." | |
echo "127.0.0.1\t$1.dev" >> /etc/hosts | |
echo "/etc/host updated ..." | |
apachectl restart | |
mate $DIR | |
open http://$1.dev | |
echo "" | |
echo "Done!" | |
else | |
echo "usage: sudo treyvhost directory" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thinking of replacing the v-host with pythons simple server
cd the dir then:
python -m SimpleHTTPServer 8080
Running the vhost stuff seem to break my local apache setup. At least for me.