Skip to content

Instantly share code, notes, and snippets.

@madr
Created April 23, 2013 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madr/5443213 to your computer and use it in GitHub Desktop.
Save madr/5443213 to your computer and use it in GitHub Desktop.
Bash: quickly adding a vhost to MAMP basic
#!/bin/bash
#
# usage: ./adp-new-vhost <name>
#
mampdir=/Applications/MAMP
confdir=$mampdir/conf/apache/extra/vhosts
codedir=~/Code
mampport=80
cat <<end > $confdir/$1.conf
<VirtualHost *:$mampport>
ServerName $1
DocumentRoot $codedir/$1
<Directory "$codedir/$1">
AllowOverride all
Options -Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
end
echo <passwd> | sudo -- sh -c "echo '127.0.0.1 $1' >> /etc/hosts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment