24 lines
495 B
Bash
24 lines
495 B
Bash
#!/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"
|