Search code examples
phplaravelnginxlaravel-valet

Laravel Valet not resolving sites after install


Having a terribly frustrating time not having valet working on a fresh install. Going to any *.test site in my browser just hangs and eventually gets the error message This site can’t be reached, "ping app.test" hangs as well, and eventually errors with "ping: cannot resolve app.test: Unknown host". However pinging a different domain (such as ping.xyz errors immediately, as opposed to after ~20 seconds like with *.test).

On Os Sierra, my composer.json looks like the following

{
    "require": {
        "laravel/installer": "^1.5",
        "laravel/valet": "dev-master"
    }
}

Since I've seen that dev-master resolved this for some people. All my processes seem to be running:

Services running

However some clues are that http://localhost/ in my browser returns a page 404 - not found, and running sudo nginx returns a bunch of already in user errors:

❯ pwd                                                                                                                                                                 
/Users/schorr/.valet

schorr@Andrew-Schorr ~/.valet 
❯ sudo Nginx                                                                                                                                                          
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

and valet fetch-share-url returns

❯ valet fetch-share-url                                                                                                                                                [17:04:53]
Failed to connect to 127.0.0.1 port 4040: Connection refused
Failed to connect to 127.0.0.1 port 4040: Connection refused
Failed to connect to 127.0.0.1 port 4040: Connection refused
...

Any help is greatly appreciated. thanks!


Solution

  • Finally figured this out, for anyone else in my very specific situation:

    I had changed my user name on the same machine, and for whatever reason installing dnsmasq wasn't overwriting the old /Users/user/.valet/dnsmasq.conf file. So at the very bottom I had:

    conf-file=/Users/OLD_USER_NAME/.valet/dnsmasq.conf
    
    conf-file=/Users/NEW_USER_NAME/.valet/dnsmasq.conf
    

    So all I had to do was comment out the OLD_USER_NAME line and was good to go :|