Laravel Valet 404 – Not found

Decided to work on a static project or html project with Laravel Valet. But that was not meant to be. Or not right away anyways. Laravel was working but all projects inside the parked folder were showing 404s.

Reinstalling Laravel Valet

So did a complete re installation of Laravel Valet following their upgrade explanation though I did that before.

Before all the main commands I did a

brew update

as well. This followed by:

valet stop
valet uninstall
composer global require laravel/valet
valet install
valet restart

Path & Domain Check

Then I checked the paths to see if parking was still working:

valet paths
[
    "/Users/jasper/.valet/Sites",

    "/Users/jasper/webdesign/valet"
]

All still fine. Then I checked the domain name in use:

 cat .valet/dnsmasq.conf 
address=/.dev/127.0.0.1

Yeah, like I wanted it to be.

Loading Valet Site

Then I opened a site inside:

/Users/jasper/webdesign/valet

which is the the folder where I parked my Valet sites using valet park . So I opened one of the sites inside valet using

directory.tld

In my case kyoko.dev. I unfortunately hit another Laravel Valet 404. A 404 served by Laravel Valet:

Laravel Valet 404

I checked the headers and as you can see it was using PHP 7.0 and NGINX as the new Laravel Valet should be serving:

Request URL:http://kyoko.dev/
 Request Method:GET
 Status Code:404 Not Found
 Remote Address:127.0.0.1:80
 Response Headers
 view source
 Connection:keep-alive
 Content-Encoding:gzip
 Content-Type:text/html; charset=UTF-8
 Date:Sun, 15 Jan 2017 06:15:37 GMT
 Server:nginx/1.10.2
 Transfer-Encoding:chunked
 Vary:Accept-Encoding
 X-Powered-By:PHP/7.0.13

Valet Logs

Then I checked the Valet logs to see what was up:

tail /Users/jasper/.valet/Log/error.log
tail /Users/jasper/.valet/Log/access.log

Both showed only stuff from last year! Nothing on this issue. Removed DNSMasq and reinstalled Valet again. It did not tell me DNSMasq was missing and said all was well?!! Must say so far the valet logs have been pretty useless. Not sure where the NGINX logs are at either if they are not the same as the Valet logs.. But perhaps that is something that is still in the works.

Valet Domain

Well restarted. Did not help.  Then I decided to check the domain used with a valet command:

valet domain localhost

It said localhost while dnsmasq said .dev . So that needed to change for sure. So made it

address=/.localhost/127.0.0.1

DNSMasq Restart

Then I restarted DNSMasq. And like all Homebrew services you do that with a brew services restart “service in question”:

brew services restart dnsmasq
Stopping `dnsmasq`... (might take a while)
==> Successfully stopped `dnsmasq` (label: homebrew.mxcl.dnsmasq)
==> Successfully started `dnsmasq` (label: homebrew.mxcl.dnsmasq)

 That worked! Only some of the latest WordPress sites had been installed with .dev so I switched back to .dev with

valet domain dev
Your Valet domain has been updated to [dev].
cat dnsmasq.conf 
address=/.dev/127.0.0.1

As you can see the Valet command did adjust the dnsmasq.conf properly… this time.

Cause

Somehow the dnsmasq config file was still stuck in .dev while Laravel Valet still was at localhost. In the end I went back to .dev . Now the site works well again.

Tagged in : Tagged in :
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.