[DISCONTINUED] See new project here: https://github.com/gmdotnet/vagrant-multi-machine-virtualbox
This is a DEV LAMP vagrant box and configuration. Use it for a basic PHP development.
- vagrant multi machine: use for separate web, db and session machine
- choose your favourite box, or get pre-configured box (see BOXES.md)
- ansible playbook for your configuration
- YAML config file. No more Vagrantfile to edit!
- with vagrant plugin HostsUpdater: no more /etc/hosts file to edit!
- virtualbox 5.x
- vagrant >1.8.4
- (optional)vagrant HostsUpdater plugin: https://github.com/cogitatio/vagrant-hostsupdater
install with
vagrant plugin install vagrant-hostsupdater
- (in case of error of shared folder mount errors) vagrant vagrant-vbguest plugin (install with the command
vagrant plugin install vagrant-vbguest
)
- download https://github.com/gmdotnet/Vagrant-LAMP/archive/master.zip
- unzip on your favorite work folder
- rename
config/config.yaml.sample
inconfig/config.yaml
- change settings in
config/config.yaml
(if you need more information about sync folder and rsync folder just have a look here: https://www.vagrantup.com/docs/synced-folders/basic_usage.html) - run
vagrant up
on folder where isVagrantfile
- (optional) make your configuration on vagrant machine entering by run
vagrant ssh
- have fun and happy coding!
- enable/disable your provision script directory in your
config.yaml
file - see the section below for more info
You can choose any box you want. This is a pre-configured LAMP stack. See BOXES.md
for software installed list.
- giuseppemorelli/lamp-stack 1.0.1 (debian jessie 8.5)
- giuseppemorelli/lamp-stack 1.0.2 (debian jessie 8.6)
- giuseppemorelli/lamp-stack 1.0.3 (debian jessie 8.6)
- created an user called
local
(passwordlocal
) with root privilegies - root password is
vagrant
- ServerName is
vagrant
- daemon user is
vagrant
- root folder is
/var/www
- mod_rewrite and mod_vhost_alias enabled
- IMPORTANT: you need to add
EnableSendfile Off
on your website configuration under <Directory "..."> ( here all info https://www.vagrantup.com/docs/synced-folders/virtualbox.html ) - All website must be
*.vagrant
because main server name isvagrant
, if you want to change please edit/etc/apache2/ports.conf
- auto-activated in PHP cli and PHP "web"
- IDEKEY = "VAGRANT"
- uncomment
xdebug.remote_host
inphp.ini
to enable your IDE for remote xdebug
- postfix is configured as satellite system with 127.0.0.1:1025
- mailhog do not start automatically. Just open a shell and type
mailhog
- web interface is set on
<vagrant ip>:8025
- web interface is set on
- all emails are not sent outside the machine
- to test:
- start mailhog
- send a test email with
echo "this is a test email | mail -s "subject test email" [email protected]
- check on your browser
<vagrant ip>:8025
the email sent
- you can use mailhog as SMTP server, just configure your application to send email at 127.0.0.1 with port 1025
backup_database.sh
: you can use this script as single shell script or enable it inconfig.yaml
There is a sample ansible playbook to enable service and configuration for your machine.
Instructions:
- rename
ansible/playbook.yml.sample
inansible/playbook.yml
- edit your
config.yaml
to enable ansible provision
provision:
ansible: yes
- start vagrant provision (automatically with new vagrant machine, with
vagrant provision
for vagrant machine previously created)
If you aren't familiar with ansible you can install Webmin panel. Just follow the instruction below.
From vagrant shell:
sudo su
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
rm jcameron-key.asc
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
apt-get update
apt-get install -y apt-transport-https
apt-get install -y webmin
Login to https://<ip vagrant or alias>:10000
with user root
and password vagrant
- root password is
vagrant
but you can simply runsudo su
from vagrant user - if you can't find a configuration in this file before, it means is used the default value
Any contribution is highly appreciated. The best way to contribute code is to open a pull request on GitHub.
Please create your pull request against the develop
branch
Giuseppe Morelli - giuseppemorelli.net