Skip to content

Instantly share code, notes, and snippets.

@whatnickcodes
Created July 14, 2015 18:51
Show Gist options
  • Save whatnickcodes/5c33cafa81d1231938b4 to your computer and use it in GitHub Desktop.
Save whatnickcodes/5c33cafa81d1231938b4 to your computer and use it in GitHub Desktop.
config.vm.provision "shell", inline: <<-SHELL
## Only thing you probably really care about
DOMAINS=("site1" "site2" "site3")
## Loop through all sites
for ((i=0; i < ${#DOMAINS[@]}; i++)); do
## Current Domain
DOMAIN=${DOMAINS[$i]}
echo "Creating directory for $DOMAIN..."
mkdir -p /var/www/$DOMAIN/public
echo "Creating vhost config for $DOMAIN..."
sudo cp /etc/apache2/sites-available/scotchbox.local.conf /etc/apache2/sites-available/$DOMAIN.conf
echo "Updating vhost config for $DOMAIN..."
sudo sed -i s,scotchbox.local,$DOMAIN,g /etc/apache2/sites-available/$DOMAIN.conf
sudo sed -i s,/var/www/public,/var/www/$DOMAIN/public,g /etc/apache2/sites-available/$DOMAIN.conf
echo "Enabling $DOMAIN. Will probably tell you to restart Apache..."
sudo a2ensite $DOMAIN.conf
echo "So let's restart apache..."
sudo service apache2 restart
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment