Laragon Overwriting Sites

I’m quite a fan of Laragon and having tried many variants in order to run my PHP sites locally, including WAMP, MAMP, Homestead and plain old php -S, I seem to have settled on this.

One thing I have noticed though is that it sometimes likes to play around with the Apache configuration files, replacing the public subdirectory that I specify, with the root folder, rendering my sites looking like this:

There are two things that you can do about this - one temporary (until you re-run Laragon) and the other, a little more permanent.

  1. Temporary

In the main screen of Laragon, click on text Menu, and drill down to Apache > Sites Enabled > Your Site

Here, alter the Document Root to include your public folder.

1
DocumentRoot "C:/laragon/www/bm-tsr" > DocumentRoot "C:/laragon/www/bm-tsr/public"

Save that, and it should work.

  1. Permanent

For this, we need to rename the file that Laragon is creating, and remove “auto.” from the filename. That should stop Laragon trying to be intelligent and replacing what we have. Go back to the main menu, and drill down here: Apache > Sites Enabled > dir:sites-enabled

In that folder, rename your file, removing the “auto.” prefix. You can see how I did that to my file: auto.bm-tsr.test.conf here:

Now edit the file, adding in the public portion (should that be relevant for you) and save it.

Don’t forget to reload Apache’s configuration if testing immediately - Menu > Apache > Reload.

Hopefully, that should be the last time it happens!


Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com