Using Vagrant to run local environments from a single VM
This creates a new named-based vhost on the IP http://192.168.33.21/.
Installed from https://gist.github.com/JeffreyWay/af0ee7311abfde3e3b73.
See also https://laracasts.com/lessons/get-off-mamp-now.
On my set up, the /vagrant
is shared with ~/Sites/projects/
.
cd
to this directory and vagrant up
.
Some helpful command line commands:
rm -rf 'foo.txt
!!
will repeat last command
First, make a new directory with index file:
mkdir Foo
vi index.php
Next, vagrant ssh
. Set up the readable url for this project and any other settings.
cd /etc/apache2/sites-available
sudo cp 000-default.conf name-of-new-one.conf
(best to keep the name the same everywhere)
sudo vi name-of-new-one.conf
Set DocumentRoot
to /var/www/name-of-new-one
Uncomment and set ServerName
to name-of-new-one.local
Exit that and then sudo a2ensite name-of-new-one
(name of the directory) and sudo service apache2 reload
exit or Ctrl D
Open up hosts file sudo vi /etc/hosts
192.168.33.21 name-of-new-one.local
Flush DNS cache: dscacheutil -flushcache; sudo killall -HUP mDNSResponder
see http://shaun.net/2012/04/clearing-the-local-dns-cache-on-os-x-lion/
wait a long time - takes about 10-15 min for my machine to clear the DNS