Created
December 20, 2012 10:15
-
-
Save joshangell/4344416 to your computer and use it in GitHub Desktop.
Simple script for setting up a new local site on a mac's native apache.
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 | |
echo "enter directory path, leave blank for current" | |
read DOCROOT | |
if [ -z "$DOCROOT" ]; | |
then | |
DOCROOT="$PWD" | |
fi | |
echo "enter domain name, defaults to current directory and will end in .dev" | |
read DOMAIN | |
if [ -z "$DOMAIN" ]; | |
then | |
DOMAIN="${PWD##*/}" | |
fi | |
echo "127.0.0.1 $DOMAIN.dev" >> /etc/hosts | |
FILE="/etc/apache2/extra/httpd-vhosts.conf" | |
echo "<VirtualHost *:80>" >> $FILE | |
echo " ServerName $DOMAIN.dev" >> $FILE | |
echo " ServerAlias $DOMAIN.*.xip.io" >> $FILE | |
echo " DocumentRoot $DOCROOT" >> $FILE | |
echo "</VirtualHost>" >> $FILE | |
apachectl restart | |
echo "All done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment