Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Last active December 28, 2015 19:59
Show Gist options
  • Select an option

  • Save clouddueling/7554441 to your computer and use it in GitHub Desktop.

Select an option

Save clouddueling/7554441 to your computer and use it in GitHub Desktop.
Vagrant settings laravel 3
127.0.0.1 worker.loc www.worker.loc localhost
# My vagrant ip from above
192.168.12.134 cloududeling.dev www.clouddueling.dev
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName www.clouddueling.dev
ProxyPreserveHost On
ProxyPass / http://192.168.12.134:5472/
ProxyPassReverse / http://192.168.12.134:5472/
</VirtualHost>
#!/usr/bin/env bash
#### FUNCTIONS
# functions used in this script
function section_header() {
purple='\e[0;35m' # purple
NC='\e[0m' # No Color
echo -e "${purple} --- $1 --- ${NC}"
}
#### BEGIN SCRIPT
section_header "Updating Package List"
sudo apt-get update
section_header "Initializing MySQL and Install Base Packages"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y vim curl python-software-properties
section_header "Updating Package List"
sudo apt-get update
section_header "Load latest PHP"
sudo add-apt-repository -y ppa:ondrej/php5-oldstable
section_header "Updating Package List"
sudo apt-get update
section_header "Installing PHP-specific Packages"
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt mysql-server-5.5 php5-mysql git-core
section_header "Installing and configuring xDebug"
sudo apt-get install -y php5-xdebug
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
section_header "Enabling mod-rewrite"
sudo a2enmod rewrite
section_header "Setting document root"
sudo rm -rf /var/www
sudo ln -fs /vagrant/public /var/www
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
# sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
sudo sed -i '/AllowOverride None/c AllowOverride All' /etc/apache2/sites-available/default
section_header "Restarting Apache"
sudo service apache2 restart
section_header "Installing Composer"
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Laravel stuff here, if you want
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS clouddueling; GRANT ALL PRIVILEGES ON *.* TO root@'%' WITH GRANT OPTION; FLUSH PRIVILEGES";
mysql -uroot -proot -h localhost clouddueling < "/var/www/dump.sql";
section_header "Migrating and Seeding Default Database"
cd /vagrant
chmod -R 777 storage
#php artisan migrate --seed
section_header "Configuration Complete, Vagrant Box Ready!"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "base"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, guest: 80, host: 5472
config.vm.provision :shell, :path => "install.sh"
config.vm.network :private_network, ip: "192.168.12.134"
end