Laravel Valet - This Site Can't Be Reached
Asked Answered
K

8

9

I have successfully followed the Setup a Mac Dev Machine until this tutorial: https://laracasts.com/series/setup-a-mac-dev-machine-from-scratch/episodes/10?autoplay=true

The problem is that when I go to SITENAME.dev, nothing shows up. Instead, I get the following message:

This site can’t be reached

test2.dev refused to connect. Did you mean http://test2.de/? Search Google for test2 dev ERR_CONNECTION_REFUSED

I've tried this both for a laravel install (using the laravel installer) and a wordpress install. Neither one works.

Any idea why it is not working. I have followed the course step-by-step as well as the comments. For instance, I modified the .zshrc file as follows based on the course and comments:

export PATH=$HOME/bin:/usr/local/bin:$HOME/.composer/vendor/bin:$PATH

And, in case it is relevant, I am on Mac Sierra (freshly updated).

In short, where Jeffrey is able to get a home page of laravel, I get an error.

Any idea how to fix this?

Thanks.

Kinney answered 11/8, 2017 at 15:3 Comment(1)
Make sure you're going to http://yoursite.test instead of https://yoursite.test that got me. Assuming you haven't done the valet secure set up (laravel.com/docs/9.x/valet#securing-sites)Pharyngeal
D
32

Go to your site folder and execute the following commands:

cd your_project
composer global update
valet uninstall
rm -rf ~/.valet
rm -rf ~/.config/valet
valet install
valet link
valet open

It fixed this issue for me, and particularly after PHP upgrades.

Doering answered 17/12, 2017 at 13:43 Comment(1)
Thanks, this works for me, actually updating composer and restarting valet resolve my issueDurkheim
U
3

Solution:

composer global update
brew upgrade nginx
cd your_project
valet start

For more details read this blog https://medium.com/@panjeh/valet-this-site-cant-be-reached-err-connection-refused-ad424ea1e343

Unlettered answered 3/5, 2020 at 12:11 Comment(1)
The brew upgrade nginx line solved my issue. Thanks!Controller
M
2

Mac os mojave - version 10.14, cd in your-project-folder-name and run valet secure your-project-folder-name

Mariejeanne answered 15/10, 2018 at 21:6 Comment(1)
My .htaccess was forcing the https urls. So default http url was not working. Running valet secure folder-name helpedRies
D
0

Have you actually started the valet service? Head over to the directory that you ran

$valet park

in, I'm assuming it's where you've also placed your project and type:

$valet start

into the terminal. That works for me.

Dennadennard answered 11/8, 2017 at 15:7 Comment(5)
Is your laravel project definitely called 'test2' and in the directory that you've set parked valet? Another thing to check is that your install is using the .dev extension $valet domainDennadennard
Yes, the project is definitely called test2 (I've done different tests with different names). I am sure that I've parked my Sites directory (where test2 is located). And I just ran valet domain and it came back dev (so it is using the .dev extension).Kinney
Have you searched the Laracasts forum for answers too? Sounds like you’re doing everything right, but someone else may have had a similar issueDennadennard
I posted on both the laracasts forum as well as the laravel/valet github issues forum. I haven't heard from them yet. I'm wondering if the problem is with Sierra. Either way - thanks for your help :).Kinney
I’m also on Sierra. Good Luck!Dennadennard
E
0

Be sure you're over http://app.test and not https://app.test

Laravel Valet uses Not secure http as default.

By the way if you want to secure your app then use

valet secure YOURAPPNAME
Easy answered 17/9, 2019 at 20:1 Comment(0)
M
0

Deleting the file (sudo rm /etc/resolver/dev) will clear this issue up.

Maura answered 9/7, 2020 at 19:9 Comment(0)
P
0

IF valet is trying to open a HTTPS (SSL connection) type command line in your terminal

valet secure
Paganini answered 24/1, 2022 at 22:16 Comment(0)
M
0

Simply running valet restart command solved my problem. I think the Dnsmasq needs to be restarted which the following command does by itself.

valet restart
Marley answered 26/12, 2023 at 12:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.