Open ivcreative opened 6 years ago
config.vm.provision "shell", inline: <<-SHELL
## Only thing you probably really care about is right here
DOMAINS=("site1.local" "site2.local")
## 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..."
cat >/etc/apache2/sites-available/$DOMAIN.conf <<EOL
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName ${DOMAIN}
ServerAlias www.${DOMAIN}
DocumentRoot /var/www/${DOMAIN}/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOL
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
SHELL
Thanks Patrick, worked for me. Vhosts on Scotchbox is awesome 👍
Thanks
The code here to use multiple domains on vagrant pro is not working the one from here
https://scotch.io/bar-talk/announcing-scotch-box-2-0-our-dead-simple-vagrant-lamp-stack-improved#toc-multiple-domains-virtual-hosts
How can we get this on this version?