To deploy my sites, I use Laravel Forge. Forge handles all of the nginx configurations for you, so you can host multiple sites on a single machine of your choice (DigitalOcean, AWS, etc). Forge will also setup Git hooks to auto-deploy any changes made to a certain branch. If you need more, you can edit the deployment script to suit your needs.
Since I wanted a blog, but didn’t necessarily want philminkler.com/blog to be the URL, I opted to setup blog.philminkler.com in Forge.
I think you’ll be amazed how easy this is.
Confirm DNS entries
First, we want to make sure that DNS is setup to forward all subdomains to the droplet (I use DigitalOcean) that Forge manages. I only have one droplet, so that makes things easy!
Sure enough, I have a wildcard setup to forward any subdomains to that address. Great.
Tell Forge to make your subdomain
Here, in Forge, I’ve filled out the address that I would like to have.
After this is made, you can go on to either install a Git repository to this location, or a vanilla WordPress site.
It’s that easy.
You can imagine how nice this would be for projects that require a continuous integration or user-acceptance testing environment! Using just one machine, some environment variables and multiple SQL instances, you can stand up all sorts of environments while only paying for one machine.