Skip to content

Instantly share code, notes, and snippets.

@tormjens
Last active July 29, 2016 22:59
Show Gist options
  • Save tormjens/f2a5cad99aeef4ab16d7724cb721122d to your computer and use it in GitHub Desktop.
Save tormjens/f2a5cad99aeef4ab16d7724cb721122d to your computer and use it in GitHub Desktop.
Vagrant - lighttpd + PHP5.5 + MySQL

Vagrant - lighttpd + PHP5.5 + MySQL

Host: 33.33.33.10

WWW-root in the www/ folder created by Vagrant

MySQL

Host: localhost / 33.33.33.10 User: root Password: root

# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
# config.vm.network :forwarded_port, guest: 80, host: 8888
config.vm.network "private_network", ip: "33.33.33.10"
config.vm.provider :virtualbox do |vb|
vb.name = "lighttpd-trusty"
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
end
config.vm.synced_folder "log/lighttpd", "/var/log/lighttpd", owner: "www-data", group: "www-data", create: true
config.vm.provision "shell", inline: <<-shell
apt-get update
apt-get upgrade -y --force-yes
apt-get install screen vim -y --force-yes
echo mysql-server mysql-server/root_password password "root" | debconf-set-selections
echo mysql-server mysql-server/root_password_again password "root" | debconf-set-selections
apt-get install mysql-server -y --force-yes
sed -i "s/^bind-address/#bind-address/" /etc/mysql/my.cnf
mysql -u root -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; FLUSH PRIVILEGES;"
/etc/init.d/mysql restart
apt-get install lighttpd php5-cgi -y --force-yes
apt-get install php5-curl php5-gd php5-ldap php5-tidy php5-xmlrpc php5-memcached php5-imap php5-mcrypt php5-json php5-mysql -y --force-yes
lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
if [ ! -f /vagrant/etc ]; then
mkdir /vagrant/etc
mv /etc/{lighttpd,php5} /vagrant/etc/
ln -s /vagrant/etc/* /etc/
fi
if [ ! -f /vagrant/www ]; then
mv /var/www /vagrant/
ln -s /vagrant/www /var/
fi
service lighttpd force-reload
shell
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment