LEMP setup with Vagrant


We use Vagrant a lot at work and we love it!

When you want to make serious PHP developement, you need the right tool for the right job and avoid stuff like XAMPP. The main reason why we prefer to use a Virtual Machine is that we want to be as close as possible to our production/staging stack. If you work on MacOS, Linux or Windows and want to setup your production environment in a sane and reproductible way, you came to the right place.

What’s in the box?

  • Ubuntu 18.04 (LTS)
  • Nginx 1.14+
  • PHP 7.2+
  • MariaDB 10.1+ (~MySQL 5.7+)
  • Redis 5.0+
  • Memcached
  • Composer

Requirements

Installation

First you need to create a folder where all your websites/projects will be. In this example we will use a folder called Vagrant located on your home folder.

git clone https://github.com/milhouse1337/vagrant-lemp.git ~/Vagrant
cd ~/Vagrant

Now you need to remove the .git folder to avoid conflicts with your own Git repos later.

rm -rf .git

Open the ~/Vagrant/_install/bootstrap.sh file in your favorite text-editor.

  • Update the MySQL root password.
  • Validate if the rest of the script feels right for you and update as needed.

When everything seems fine you launch it. πŸš€

vagrant up

You will have to wait a few seconds (minutes) β˜•οΈ for the script to complete. When everything is done you have a complete LEMP setup to play with. πŸ€“

For more information visit the Git repo: https://github.com/milhouse1337/vagrant-lemp

EOF