Valet: Site can't be reached

Created on 19 Jan 2017  ·  44Comments  ·  Source: laravel/valet

After following the upgrade instruction to v2.x I had issues first to get php-fpm running, but now no sites can be reached.

Tried uninstalling php, nginx and valet and installing it again according to the instructions, but to no avail.

I had to start php-fpm manually after install valet to get the valet.sock file created. I can ping all .dev domains, which means the dnsmasq is at least working.

Most helpful comment

it works well after ran

$ sudo brew services start nginx
$ sudo brew services start php71
$ sudo brew services start dnsmasq

it seems that valet cannot start those services successfully.

All 44 comments

Nginx doesn't appear to be running. I assume it should be running?

ps aux | grep nginx
renedekat       98694   0.0  0.0  2432804   2028 s003  S+    2:18pm   0:00.00 grep nginx

Starting it with brew services start nginx says it was started successfully, but it doesn't show up in the process list.

Starting it with

sudo brew services start

Solved it.

Shouldn't the valet start/install command take care of that? Or at least log if it fails.

I recall hearing a few people moving from v1 with Caddy to v2 with Nginx that they needed to reboot their Mac to get the services to not clash. I can't recall if it was because Caddy didn't shut down fully or if for some reason the valet start couldn't complete due to old services still running on same ports.

i rebooted and still not working, @renedekat's idea worked though.

Is there any new fix? I've same trouble with macOS Sierra. I started nginx with brew services start nginx here is my output after few seconds ... :( On my other ElCapitan machine it's working fine.
bildschirmfoto 2017-01-23 um 20 41 04

@mludi "cannot resolve" is a DNS matter.

Perhaps dnsmasq isn't running properly? Refer to the discussion in #299 for help with resolving DNS issues with reaching your .dev domains.

Thanks @drbyte yeah issue is the same, but it doesn't help :(

Okay. I'd be interested in seeing what's in your dnsmasq log file.
Post over in #299 and we can chat about it more there.

I had to use sudo brew services start --all and I can get to sites in browser, but for some reason I get timeouts pinging them.

same here.
valet start, valet stop and valet restart not work at all.

it works well after ran

$ sudo brew services start nginx
$ sudo brew services start php71
$ sudo brew services start dnsmasq

it seems that valet cannot start those services successfully.

Try updating to dev-master. I noticed on my machine that "brew services
restart" stopped working completely for services that needed to be started
as root, and that's the command valet is trying to use. I've update valet
to explicitly stop and start instead of relying on restart, hopefully it's
an issue in the home brew ecosystem that will get fixed.
On Tue, Jan 24, 2017 at 8:16 AM Chino Chang notifications@github.com
wrote:

it works well after ran

$ sudo brew services start nginx
$ sudo brew services start php71
$ sudo brew services start dnsmasq

it seems that valet cannot start those services successfully.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/laravel/valet/issues/298#issuecomment-274799696, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEH3bL6ts5FMMyQH60W1N_wE9TyyjUjrks5rVfmUgaJpZM4LoIk5
.

@adamwathan and @kinosang It's the exact problem, valet can't execute the sudo commands.

Thanks by your contribution.

I had the same issue and running the commands mentioned by @kinosang solved it. Thanks.

Also update homebrew (while debugging the issue) but it doesn't seem to have resolved this issue yet.

Using dev-master seems to fix the problem thanks @adamwathan

Where did you find dev-master? I only see one branch....

@riskiii dev-master means to just used the master branch instead of a tagged release.

Update your ~/.composer.json file so the valet entry looks like this:

"laravel/valet": "dev-master"

...then run composer global update.

After that try going through the Valet setup instructions again (valet install, etc.).

Thanks, now it is clear.

@adamwathan Just wanted to +1 that changing to dev-master fixed my issues on a brand spankin new MacBook.

@adamwathan this also fixed the issue for me on my new MacBook Pro that I got today! Thank you very much.

I have tried the above approach by pointing to dev-master and run the composer global update

but i am seeing these errors

`Changed current directory to /Users/eric/.composer
Loading composer repositories with package information
Updating dependencies (including require-dev)

  • Removing laravel/valet (v2.0.3)
  • Installing laravel/valet (dev-master e832fc7)
    The authenticity of host 'github.com (192.30.253.113)' can't be established.
    RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    Are you sure you want to continue connecting (yes/no)? yes
    Cloning e832fc73cc5a96742dfb2f61f804812e6d28bdde
    Failed to download laravel/valet from source: The process "git clone --no-checkout 'https://github.com/laravel/valet.git' '/Users/eric/.composer/vendor/laravel/valet' && cd '/Users/eric/.composer/vendor/laravel/valet' && git remote add composer 'https://github.com/laravel/valet.git' && git fetch composer" exceeded the timeout of 300 seconds.
    Now trying to download from dist
  • Installing laravel/valet (dev-master e832fc7)
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%

[Composer\Downloader\TransportException]
The "https://api.github.com/repos/laravel/valet/zipball/e832fc73cc5a96742dfb2f61f804812e6d28bdde" file could not be written to /Users/eric/.
composer/vendor/laravel/valet/f76b1e6e8e1073a8ddfd2a3cce3154f8: failed to open stream: No such file or directory

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] []...`

any help? Thanks.

@ericmachine88 All those errors look like something wrong between your computer and github.

If I run this command separately, I can clone project from github

example

git clone --no-checkout 'https://github.com/laravel/valet.git' .

Not sure why I am seeing this issue. So weird...

Anyway, I am going to run the commands separately and see whether it works

Okay I got this error

Eric-MacBook-Pro:~ eric$ cd ~/.composer/vendor/laravel/ Eric-MacBook-Pro:laravel eric$ git clone --no-checkout 'https://github.com/laravel/valet.git' . fatal: destination path '.' already exists and is not an empty directory. Eric-MacBook-Pro:laravel eric$ git clone --no-checkout 'https://github.com/laravel/valet.git' Cloning into 'valet'... remote: Counting objects: 2209, done. remote: Compressing objects: 100% (4/4), done. error: RPC failed; curl 56 SSLRead() return error -36 KiB/s fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

Any idea? Thanks.

You're getting a lot of communication problems:

  • The authenticity of host 'github.com (192.30.253.113)' can't be established.
    RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    Are you sure you want to continue connecting (yes/no)? yes

  • Failed to download laravel/valet from source: The process ... exceeded the timeout of 300 seconds.
    Now trying to download from dist

  • [Composer\Downloader\TransportException]

  • The file ... could not be written ... : failed to open stream: No such file or directory

  • error: RPC failed; curl 56 SSLRead() return error -36 KiB/s
    fatal: The remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed```

I don't think any of this has to do with valet specifically.

i used the official guide and working now..

i made a mistake in my ~/.bash_profile to still point to php70 instead of php71 :) cool it works now

Since @kinosang solution is working like a charm, maybe valet should require brew services (like it requires brew nginx) and run brew services restart [each service] on valet restart

@kinosang I have found this issue on today, thank you for your solution.

I was also getting the site cannot the reached error but none of these fixes worked.

I ran sudo nginx which showed an error related to ssl certificates (which I had manually deleted... tut tut) Deleting the corresponding .conf file in .valet/Nginx fixed the problem.

Running sudo nginx shouldn't return anything (or at least it doesn't now that my issue is fixed) so if it does then that could help debug this problem if none of the above solutions worked for you.

How do I change the host of myproject.dev to myproject.host ??

@HermanMonteiro Try

valet domain host

I'm using laradock and decided to give valet a shot on a my new Mac. I have to say this is dissapointing experiance so far. Beginning of this thread is from January 2017 and issues still seem not to be fixed. Wasted 4 hours trying to get it to work.

I'm using laradock and decided to give valet a shot on a my new Mac. I have to say this is dissapointing experiance so far. Beginning of this thread is from January 2017 and issues still seem not to be fixed. Wasted 4 hours trying to get it to work.

... and yet you give zero context such as actual error messages, or which of the dozens of troubleshooting steps above you've tried and what their results were, or anything else.
I get it: you're not asking for help. You just wanted to complain. Point made.

But it's working swimmingly for thousands of people.

Nevertheless, you're right about one thing: this ticket is old, and relates to early versions of Valet.
So, that's a problem: this Issue should be closed.

Hi, yeah it might sound like a moaning on my end but believe me I went through all the errors and troubleshoot most of them just by googling.

I'm on OSX High Sierra, however, I have to say that experience is nowhere near to what is being advertised. Error after error after error. I just simply gave up. I understand that some of the issues might be related to homebrew and not valet itself but still, there is no way to follow tutorial on https://laravel.com/docs/5.4/valet and get it to work. Seems like everything has changed.

I'm just saying that tutorial might need a step by step "how to" on a fresh install OSX installation.

Thank you.

@aurawindsurfing did you look at the more up to date docs?

https://laravel.com/docs/5.5/valet

Mostly all the errors I've ever encountered have been covered there 👍

Yes I did. to name a few I had encountered:

  1. problems with installing composer via brew and then making it global - not valet related
  2. once composer was installed every command had to be run with sudo
  3. once I managed to ping domain then the above "Site can't be reached" issue started

So yes I did follow the tutorial and yes I will get it to work sooner or later. My point is that none of those issues are covered in the docs. Valet should be easy to install and run but it is not really the case at the moment.

Cheers!

@aurawindsurfing
I know what you're saying, but I don't think that's a failing of Valet as such but rather the method used to install it and the environment surrounding such circumstance. I personally have installed Valet in a whole range of different environments several times and have never encountered an error that wasn't something I did wrong nor was in the documentation.

If you could provide the errors you were getting and the solutions you used to solve those issues, it might be valuable to fix the issue or at least add it to the documentation which you say its not there right now.

If anyone experiences any new issues related to this, please feel free to open a new issue.

(And please--if the docs need updating, let's make clear and direct issues for that, OR pull requests to the docs, and we'll get the docs updated!)

Finally! If anyone else runs into this issue, I found myself in a situation recently where only this list of commands would fix it: https://github.com/laravel/valet/issues/326#issuecomment-281254202

For some fucked up reason, I got the "cannot resolve" issue when valet-linking sites to .test domains that contained a dash. For example, my-api.test did not work, but myapi.test works just fine.

Hope it helps someone.

A mi me funciona usando : ping *.test
ejemplo: ping foo.test
creo que es la actualizacion de valet. ya no se usa el ping *.dev
Sino pueden cambiar de dominio del valet
valet domain [nombredominio]

If anyone will be struggling with composer issue like I was 2 months ago please run:

brew install composer

if this does not work check:
echo $PATH

You should see reference to a composer file. If it is not there run:
export PATH=$PATH:~/.composer/vendor/bin

and then:
echo $PATH
to see if it was added, now try again:
brew install composer

then:
valet install

I hope it helps someone as this step was obvious but missing from official tutorial.

After install and configure valet (just composer require and valet install commands), I wasn't able to ping on foo.dev, so I started to investigated what's going on there. After checking the ~/.valet/dnsmasq.conf and the ~/.valet/config.json file, I saw that:

address=/.test/127.0.0.1 (on dnsmasq.conf) and
"domain": "dev" (on config.json)

So, it's not foo.dev, but foo.test. And it worked. But if you prefer working with .dev, just replace .test for .dev and run valet install again after doing this changes. It should work now, try to ping for foo.dev now.

I hope it work for some of you guys. It was my case, maybe some of you are still facing this "problem".

Was this page helpful?
0 / 5 - 0 ratings