Created
February 2, 2014 22:48
-
-
Save romanodesouza/5238a3bff371b0c99db0 to your computer and use it in GitHub Desktop.
Vagrant + PHP + Phalcon + MySQL 5.6 + Nginx + memcached + apcu + xdebug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "quantal64" | |
config.vm.network :forwarded_port, guest: 8080, host: 8080 | |
config.vm.hostname = "vagrant-php" | |
config.vm.provision "shell", inline: <<SCRIPT | |
# Apt | |
sed -i 's,archive\.,br\.archive\.,' /etc/apt/sources.list | |
apt-get update | |
apt-get install --yes \ | |
python-software-properties \ | |
software-properties-common | |
add-apt-repository ppa:ondrej/php5 | |
add-apt-repository ppa:ondrej/mysql-5.6 | |
add-apt-repository ppa:ondrej/nginx | |
apt-get update | |
debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password password dev' | |
debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password_again password dev' | |
apt-get install --yes \ | |
locate \ | |
curl \ | |
vim \ | |
make \ | |
gcc \ | |
git \ | |
php5-fpm \ | |
php5-cli \ | |
php5-json \ | |
php5-apcu \ | |
php5-memcached \ | |
php5-xdebug \ | |
php5-dev \ | |
libpcre3-dev \ | |
nginx \ | |
mysql-server-5.6 \ | |
memcached | |
rm /etc/php5/cli/conf.d/20-readline.ini | |
# Phalcon | |
PHALCON_VERSION=1.3.0 | |
cd /usr/local/src | |
git clone -b $PHALCON_VERSION --depth 1 https://github.com/phalcon/cphalcon.git | |
cd cphalcon/build | |
./install | |
echo "extension=phalcon.so" > /etc/php5/mods-available/phalcon.ini | |
ln -sf /etc/php5/mods-available/phalcon.ini /etc/php5/cli/conf.d/20-phalcon.ini | |
ln -sf /etc/php5/mods-available/phalcon.ini /etc/php5/fpm/conf.d/20-phalcon.ini | |
rm /etc/nginx/sites-enabled/default | |
> /etc/nginx/sites-available/phalcon cat <<-EOF | |
server { | |
listen 8080 default_server; | |
server_name vagrant-php; | |
index index.php index.html index.htm; | |
set \\$root_path '/vagrant/public'; | |
root \\$root_path; | |
try_files \\$uri \\$uri/ /index.php?_url=\\$uri; | |
location ~ \\.php { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME \\$document_root\\$fastcgi_script_name; | |
fastcgi_param ENVIRONMENT "DEV"; | |
} | |
location ~* ^/(css|img|js|flv|swf|download)/(.+)\\$ { | |
root \\$root_path; | |
} | |
} | |
EOF | |
ln -sf /etc/nginx/sites-available/phalcon /etc/nginx/sites-enabled/ | |
# Post-install | |
>> /etc/rc.local cat <<-EOF | |
service php5-fpm start | |
service mysql start | |
service nginx start | |
service memcached start | |
EOF | |
service php5-fpm restart | |
service nginx restart | |
SCRIPT | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment