Search code examples
apachevhostsdnsmasqlaravel-valet

Laravel Valet with Apache + dnsmasq


I have Laravel Valet installed and configured to .loc domain (was working just fine)
Then I needed Apache server alongside with Laravel Valet, so I followed these instructions: https://getgrav.org/blog/macos-mojave-apache-mysql-vhost-apc
I configured Apache to serve .test domains. After I was done with instructions above, .test domains started working, but sites served by Laravel Valet (.loc) stopped working.

When I open any .loc site it loads localhost page (served by Apache).
My virtual hosts: /usr/local/etc/httpd/extra/httpd-vhosts.conf file:

<VirtualHost *:80>
    DocumentRoot "/Users/daiyrbek/Sites"
    ServerName localhost
</VirtualHost>

# and few other exact hosts like: site1.test -> ~/Sites/site1

What I want is:
.loc should be served by Laravel Valet
.test should be served by Apache

My /usr/local/etc/dnsmasq.conf file:

address=/.test/127.0.0.1

conf-file=/Users/daiyrbek/.config/valet/dnsmasq.conf

/Users/daiyrbek/.config/valet/dnsmasq.conf file:

address=/.loc/127.0.0.1
listen-address=127.0.0.1

How to work around this?


Solution

  • Basically it's not possible to achieve what I am trying to do as Laravel Valet's requirements are:

    Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.

    https://laravel.com/docs/6.x/valet#installation