How to set up LEMP for PHP Development with Vagrant and Ubuntu 14.04

Install Virtual Box and Vagrant

  1. Download and install VirtualBox
  2. Download and install Vagrant

Create a directory for your virtual machine and websites

Create your Vagrantfile

make the following changes to your Vagrantfile

uncomment Line 26

config.vm.network “private_network”, ip: “192.168.33.10”

uncomment Line 41

Set the path for the first option to the folder on the host machine you want to share and set the second option to the path of the nginx server

config.vm.synced_folder “/Documents/repos/”, “/usr/share/nginx/”

Create your virtual machine

The amount of time it takes to create your virtual machine depends on your bandwidth speed. If everything go correctly you should something similar to the line below.

Once the virtual machine has been created you will need to ssh into you vagrant machine with the command below.

You should see the following lines shown below

Run the following command.

Install nginx

Install Mysql – You will be asked to supply a root (administrative) password for use within the MySQL system.

Secure Mysql Server

Install Git

Install base php

Install PhpMyAdmin

  1. Run the command below
  2. Press tab to skip choosing a server type than press enter
  3. Choose yes to set up default config
  4. Follow the prompts

Create a symbolic link for php myadmin and restart nginx

Change the following settings in /etc/php5/fpm/php.ini

Make the following changes to /etc/nginx/sites-available/default

Restart php5-fpm and Nginx

Install Composer Globally