Git Product home page Git Product logo

Comments (9)

Cethy avatar Cethy commented on July 29, 2024 3

The easy way :

    1. clone the scotch-box in another dir ;
    1. edit Vagrantfile, modify this line config.vm.network "private_network", ip: "192.168.33.10" to the ip address you want ;
    1. edit your host file
    1. And ... done. :)

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

Cethy is spot on here. This is exactly how you would do it.

from scotch-box.

Dobby89 avatar Dobby89 commented on July 29, 2024

Excellent. That's exactly what I was after. Thank you!

from scotch-box.

unclepickles avatar unclepickles commented on July 29, 2024

Thanks for that, I used it and it worked, however wouldn't running two vm's be a burden on the PC?
In Homestead you do provisioning and I guess it is a matter of using multiple hosts on the same VM, can't that be done?

from scotch-box.

Eoler avatar Eoler commented on July 29, 2024

It's more a disk space hog (Vagrant can't run two VirtualBox VMs at the same time IIRC).
This branch contains Homestead-like .yaml provisioned multisite fork with automatic hosts handling:
https://github.com/Eoler/scotch-box/tree/multisite

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

Check this too: https://scotch.io/bar-talk/announcing-scotch-box-2-0-our-dead-simple-vagrant-lamp-stack-improved#multiple-domains-(virtual-hosts)

from scotch-box.

Cethy avatar Cethy commented on July 29, 2024

@unclepickles It's totally possible to host multiple hosts on the same VM (like any other machine), it's become a matter of apache/nginx/... configuration. But it was not what @Dobby89 wanted to achieve (good separation of his projects).

To answer your question on burden, VirtualBox is very good at handling multiple VMs (usually 3-4 on my mba'13 with no problem, besides the battery).
But then, you CAN optimize while keeping the separation between services with a project like Docker, but ... yeah, this thing is really scary :)

from scotch-box.

unclepickles avatar unclepickles commented on July 29, 2024

Thanks everyone for your wonderful responses, ncerminara 's in particular emplying Yaml is superb.
I love this box it makes life much easier, I used to have loads of problems with Homestead.

Wonder if we can discuss adding/upgrading apps in here too? or is this thread specific to the box only?

from scotch-box.

unclepickles avatar unclepickles commented on July 29, 2024

it's been applied, and it worked, for those who don't know and want a quick explanation it's as follows:
I learnt it from the page in ncerminara's post.
However, here's my setup:

hosts (file)
127.0.0.1 localhost
::1 localhost
192.168.33.10 main.dev
192.168.33.10 lara1.dev
192.168.33.10 lara2.dev
192.168.33.10 gsd.dev
and then the vagrant file:
Vagrant.configure("2") do |config|

config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

 config.vm.provision "shell", inline: <<-SHELL

        ## Only thing you probably really care about is right here
        DOMAINS=("lara1.dev" "lara2.dev", "gsd.dev")

        ## 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

    SHELL

end

when I open lara1.dev I get the right place, and when I open gsd too I can see what I put in there, and the main file (scotchbox itself) that also works, but lara2.dev I get diverted to main, any suggestions?

from scotch-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.