valet: Secure sites connection refused
I’m seeing an issue (Valet 2.0.3) where securing a site throws no errors in terminal or ~/.valet/Log/error.log
. Pinging the site works fine, but visiting the site through any browser returns the connection refused page.
Has anyone else experienced and/or fixed this?
NB. There’s a few threads on issues with securing sites, but I think my issue is different so opening a clean issue.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (4 by maintainers)
I had this problem and solved it by just updating my Valet installation with composer.
composer global update
and then running:
valet install
Hey there 🙂 ,
just wanted to leave an info that might help resolve the problem for some Valet users.
I just ran into the same problem. Securing the site via
valet secure
seemed to work with no issues since Valet reports no problems. Accessing the site in the browser however results in anERR_CONNECTION_REFUSED
.The
~/.valet/Log/nginx-error.log
log was empty. Peaking into the/usr/local/var/log/nginx/error.log
log like @drbyte suggested helped me finding the solution for my particular problem:In my case the log file stated
[...] [emerg] 65848#0: the "http2" parameter requires ngx_http_v2_module in /Users/[...]
.I had
nginx
already installed at the time i installed Valet sovalet install
skipped installingnginx
. As the log file stated my nginx installation was missing thengx_http_v2_module
for http2 support. However the nginx vhost configurations Valet creates assume this module is available in the listen directive:listen 443 ssl http2;
.Since valet installs nginx with
brew install nginx --with-http2
this particular problem certainly won’t occur on systems not having nginx already installed.Reinstalling nginx with the http2 module solved it for me:
sudo brew services stop nginx
brew remove nginx
brew install nginx --with-http2
sudo brew services start nginx
Maybe Valet should also check for http2 support when checking if nginx is installed. One solution might be checking the output of
nginx -V
(which provides the switches nginx has been configured with) and checking for the existance of the--with-http_v2_module
flag.Hope this info is useful to anyone. ~Regards
To stop apache from hijacking your port 80 you could:
sudo /usr/sbin/apachectl stop
after that just restart valet
valet restart
Are you still using .dev? Chrome fucked that up for everyone so switch to a different TLD if so. On Wed, Dec 20, 2017 at 2:17 PM Ryan Gurnick notifications@github.com wrote:
i insert
valet secure
its works for me“It works!” is an Apache thing, so you’ll want to disable that so it stops hijacking port 80:
https://gist.github.com/adamwathan/6ea40e90a804ea2b3f9f24146d86ad7f#problem-i-just-see-it-works
Anyone running into this issue, it seems the most common solutions are:
.dev
TLDIf you run into this issue and those fixes don’t work, please open a new issue. Thanks!
Guys try securing your sites with valet secure examplesite from your site directory.This worked for me with Valet Linux.Hope this helps.
I had the exact same situation at one point. I managed to kill my local mariadb. It was at this point I switched to Homestead