Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vhost multiple domains old code not working #13

Open
ivcreative opened this issue Dec 20, 2017 · 3 comments
Open

vhost multiple domains old code not working #13

ivcreative opened this issue Dec 20, 2017 · 3 comments

Comments

@ivcreative
Copy link

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?

@patrick-yi-82
Copy link


    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

@clotted
Copy link

clotted commented Feb 17, 2018

Thanks Patrick, worked for me.
Vhosts on Scotchbox is awesome 👍

@ivcreative
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants