A custom Vagrant Box for PHP Web Development.
Goals and Principles
- Convention over Configuration
- Optimize for Performance
- Multi-Project Support
- Latest Software
- Solid Backup Strategy
- Comprehensive Documentation
- Automate everything
- Ubuntu 16.04 64-bit
- Docker Engine
- Docker Compose
- Apache 2.4
- Nginx 1.9
- PHP 7.0 (FPM)
- MySQL 5.7
- Redis 3.0
- Memcached 1.4
- Git 2.x
- Node.js 6.x
- npm 3.x
- SQLite 3.8
Node Modules (global)
- Vagrant >= 1.8.0
- VirtualBox, VMWare Workstation/Fusion or Parallels
- Clone the repository
settings.yamlto your needs
vagrant upto run the initial provisioning
It's possible to define PHP settings per directory using .user.ini files.
Note that the INI directive
user_ini.cache_ttl has been lowered to 10 seconds to detect changes faster.
MySQL has been set up to use the
utf8mb4 character-set and
utf8mb4_unicode_ci collation by default.
Virtual hosts in the
hosts directory will be served by the configured web-server.
Files inside a host directory are publicly accessible except you create a sub-directory called
httpdocs which makes Nginx serve files from within one of these directories and all outside files won't be publicly
accessible. SSL is configured and files will be served from within the same public directory.
Hostnames will map to directories in a certain way. Nginx will check if the given hostname maps to an existing directory or will strip off subdomains as long as a directory matches. This enables having subdomains pointing to a single host directory.
Imagine the domain
username.members.project.com.local. The last part
local will be ignored. The leading part
username.members.project.com will be used to determine the host directory by looking up if a directory with the
same name exists or, otherwise, stripping of
members and even
project to find an existing one.
Furthermore Nginx will check if one of the directories
httpdocs exist inside the determined
directory and if, will use it as the public directory and map the hostname to it, otherwise not.
Files will be served publicly for each host from within a subdirectory named
htdocs. Apache doesn't support
"on-the-fly" configuration of the final document root directory path like Nginx does. If you need to changed the
directory name of the document root path, have a look at the next chapter -
Nevertheless, Apache still support wildcard subdomains, which means
username.members.project.com.local will be mapped
to the host's public directory path
username.members.project.com/htdocs. Apache does not support determining the
final document root path by stripping of subdomain parts.
Host configuration files stored in
hosts/nginx will be loaded automatically, depending on which
web-server you have configured to be used.
Support for various loopback/tunnel providers is baked in. Supported are:
Valid domains which map to host directories are:
project.com will map to the directory
All emails sent won't be delivered to their recipients, they will be stored
in the local
vagrant user's mailbox which you can easily access via IMAP
vagrant as password. It's also be possible to just install a webmail
client like roundcube and use it to read the emails.
The MySQL databases get dumped every hour into the directory
Optionally they'll be dumped on every
If installed, the
vagrant-triggers plugin is used to create database backups,
before halting, suspending or destroying the VM. If the plugin is not installed
database backups will still be created every hour.
- box: Name of the base box to use. Can be a local box or a box hosted on Atlas.
- version: Version constraint for the base box version to use.
- name: Name of the VM, which is displayed in the GUI of the provider. Should be unique per provider.
- hostname: Defines the hostname of the VM.
- memory: Amount of RAM in MB the VM will be assigned.
- cpus: Number of virtual CPU cores the VM will be assigned.
- timezone: Defines the server's timezone.
- http: Local port number to map the HTTP service to.
- https: Local port number to map the HTTPS service to.
- mysql: Local port number to map the MySQL server to.
- redis: Local port number to map the Redis server to.
- domains: List of local top-level-domains.
- directory: Local path of the hosts directory. Can be relative or absolute.
- variables: List of environment variables to set for the VM's web-server.
- folders: List of custom synced folders.
- ports: List of custom forwarded ports.
vagrant reload to apply changes made in settings.yaml.
Only tested on Windows 10 using VMware Workstation 11.