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 to be the URL, I opted to setup 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.

One thought on “Adding a new subdomain with Laravel Forge

  1. Thank you! Thank you! Thank you!

    Your post has saved me configuring my app on Forge when using subdomains. You have the only blog post with detailed images on DNS configuration. Cannot thank you enough! Have a good day!

    Regards from Guayaquil, Ecuador

Leave a Reply

Your email address will not be published. Required fields are marked *