Comments (9)
The easy way :
-
- clone the scotch-box in another dir ;
-
- edit
Vagrantfile
, modify this lineconfig.vm.network "private_network", ip: "192.168.33.10"
to the ip address you want ;
- edit
-
- edit your host file
-
- And ... done. :)
from scotch-box.
Cethy is spot on here. This is exactly how you would do it.
from scotch-box.
Excellent. That's exactly what I was after. Thank you!
from scotch-box.
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.
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.
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.
@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.
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.
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)
- PHP Version with Pro
- Guest additions version outdated/incompatible HOT 3
- Can we get scotch.io to a LTS dist?
- SB 3.5 shows default home page for every project HOT 2
- Vagrant Up - Unable To Fetch HOT 2
- There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. HOT 1
- Laravel mix not working by default HOT 1
- Ubuntu 17.10 is EOL, and provisioning new box now fails as a result HOT 7
- Error with Craft CMS on Installation
- 38456 HOT 1
- Vagrant up not working HOT 1
- Vagrant up not working (MacOS) HOT 1
- Scotch Box 3.5 not running on macOS Catalina HOT 2
- Uncaught Error: Class 'PDO' not found HOT 1
- 403 Forbidden error when using NFS on MacOS Catalina HOT 1
- Invalid link HOT 1
- For NodeJS apps: nodemon doesn't work HOT 1
- PHP 5.6 is installed by default on the free version HOT 2
- the php version need be update to 7.4 HOT 1
- vagrant up error: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scotch-box.