Basic LEMP development stack for Vagrant.
-
Install vagrant from vagrantup.com
-
Download and Install VirtualBox from virtualbox.org or use VMware Fusion
-
Ubuntu developer tools (If you're running ubuntu, skip if using Windows)
$ sudo apt-get install linux-headers-generic build-essential dkms
-
Clone this repository to a folder of your choice (I have it in my user folder)
-
Add this row to your local machine's "hosts" file (Linux/Mac: "/etc/hosts")
192.168.30.10 local.dev
-
Install helper plugins
- Guest Additions Assists with folder syncing and various OS improvements
$ vagrant plugin install vagrant-vbguest
-
Install helper gems
- Librarian to automatically handle Chef cookbooks.
$ gem install librarian-chef
-
Open Vagrantfile and uncomment/comment changes specific to your environment, some things to look for:
- Choose OS, the default is Ubuntu 18.04 (Bionic Beaver)
- Ram Adjustments
- Port Mapping
- Synced Folders
-
Open bootstrap.sh and comment/uncomment changes to your specific setup.
-
Go to the repository folder and run librarian-chef install to download all required cookbooks.
$ cd [repo] $ librarian-chef install
-
Still inside the repository [repo] folder, start the provisioning process
$ vagrant up
-
Wait for vagrant to download, start and provision your virtual machine (this can take a while)
-
When the setup is done you can visit your local development host at http://local.dev/
-
Any files you add to the folder
sites/local.dev/
will be visible at http://local.dev/ -
Now you can configure your own sites, see the configuration section below.
Installed software:
- Nginx
- MariaDB
- php
- Composer
- git, subversion
The vagrant machine is set to use IP 192.168.30.10 by default.
If your firewall blocks port 80 incoming, uncomment #config.vm.network :forwarded_port, guest: 80, host: 8080 in Vagrantfile before provisioning
* Sites would then be accessable via http://local.dev:8080/ or
* You can use Fiddler to setup an outgoing proxy that you can use to still access http://local.dev/
* Download Fiddler
* Goto Tools > Hosts
* Check the box that say: Override remapping...
* Add these lines. Fiddler also allows wildcard usage if you want to get fancy. You'll have to read their documentation.
$ 192.168.30.10:8080 local.dev
* Save and it should work correctly.
Port 33066 is forwarded to MySql, with a default vagrant/vagrant user so you can use your favorite client to administer databases.
Site configurations are stored in the sites-conf folder
. These conf files get copied over to the apache sites-enabled folder.
Whenever you need to apply new configurations all you need to do is run the provisioning again.
$ vagrant provision