Install Virtual Box and Vagrant
- Download and install VirtualBox
- Download and install Vagrant
Create a directory for your virtual machine and websites
|
cd Documents mkdir repos cd repos |
Create your Vagrantfile
|
vagrant init ubuntu/trusty64 |
make the following changes to your Vagrantfile
config.vm.network “private_network”, ip: “192.168.33.10”
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.
|
==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Mounting shared folders... |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-36-generic x86_64) * Documentation: https://help.ubuntu.com/ System information as of Sat Sep 27 05:52:48 UTC 2014 System load: 0.9 Processes: 88 Usage of /: 2.7% of 39.34GB Users logged in: 0 Memory usage: 17% IP address for eth0: 10.0.2.15 Swap usage: 0% Graph this data and manage this system at: https://landscape.canonical.com/ Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 0 packages can be updated. 0 updates are security updates. vagrant@vagrant-ubuntu-trusty-64:~$ |
Run the following command.
Install nginx
|
sudo apt-get install nginx |
Install Mysql – You will be asked to supply a root (administrative) password for use within the MySQL system.
|
sudo apt-get install mysql-server |
Secure Mysql Server
|
sudo mysql_install_db sudo mysql_secure_installation |
Install Git
Install base php
|
sudo apt-get install php5-fpm php5-mysql php5-cli php5-json php5-mcrypt php5-curl php-pear build-essential php5-dev -y sudo pecl install xdebug -y sudo php5enmod json sudo php5enmod mcrypt sudo service php5-fpm restart |
Install PhpMyAdmin
- Run the command below
- Press tab to skip choosing a server type than press enter
- Choose yes to set up default config
- Follow the prompts
|
sudo apt-get install phpmyadmin |
Create a symbolic link for php myadmin and restart nginx
|
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html |
Change the following settings in /etc/php5/fpm/php.ini
Make the following changes to /etc/nginx/sites-available/default
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
20 server { 21 listen 80 default_server; 22 listen [::]:80 default_server ipv6only=on; 23 24 root /usr/share/nginx/html; 25 index index.php index.html index.htm; 26 27 # Make site accessible from http://localhost/ 28 server_name localhost; 29 30 location / { 31 32 try_files $uri $uri/ =404; 33 } 34 35 location ~ \.php$ { 36 # First attempt to serve request as file, then 37 # as directory, then fall back to displaying a 404. 38 try_files $uri =404; 39 # Uncomment to enable naxsi on this location 40 # include /etc/nginx/naxsi.rules 41 fastcgi_split_path_info ^(.+\.php)(/.+)$; 42 fastcgi_pass unix:/var/run/php5-fpm.sock; 43 fastcgi_index index.php; 44 # fastcgi_index index.php; 45 include fastcgi_params; 46 } 47 48 # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests 49 #location /RequestDenied { 50 # proxy_pass http://127.0.0.1:8080; 51 #} 52 53 error_page 404 /404.html; 54 55 # redirect server error pages to the static page /50x.html 56 # 57 error_page 500 502 503 504 /50x.html; 58 location = /50x.html { 59 root /usr/share/nginx/html; 60 } |
Restart php5-fpm and Nginx
|
sudo service php5-fpm restart sudo service nginx restart |
Install Composer Globally
|
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer |