valet: Valet secure does not work
OS: macOS Sierra 10.12.1
Valet version: 1.1.22
Hello,
When I execute the command valet secure
, a message says that the site has been secured with a fresh TLS certificate (as it should).
If I try to access (http and https) the website, it gives me a browser 404 (so Valet does not seem to run). If I unsecure the site however, it works fine.
What could be the problem? I tried to completely remove Valet (including ~/.valet
). Still no luck 😕
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 47 (18 by maintainers)
Commits related to this issue
- Valet secure does not work Issue #208 This is regarding the issue #208 valet secure does not work because of naming. — committed to azimidev/valet by deleted user 7 years ago
I found a gist by Adam Wathan about Troubleshooting Valet on Sierra that helped me with this issue:
https://mysite.dev
touch /Users/myusername/.valet/Log/access.log
valet restart
https://mysite.dev
. Success!@ahmedash95 did you have Nginx already installed before installing Valet?
Try
valet stop && brew uninstall --forge nginx
, then re-runvalet install
to make sure nginx is installed with the correct flags.Had the same problem and it turned out I needed to update to the latest version of Laravel Valet. I was using 2.0.3 and now updated to 2.0.4 which solved my problem.
Hope this helps!
When use valet secure,nginx needs
ngx_http_v2_module
.Trynginx -t
you will get the info. In mac,valet stop && brew uninstall --forge nginx
andbrew install nginx --with-http2
now it works. the option--with-http2
activate thengx_http_v2_module
.PS: Valet source
Nginx.php
Brew.php
So,if you installed the nginx without http2 before valet,valet secure will not work;
https://github.com/laravel/valet/blob/master/cli/Valet/Site.php#L239
just change
/C=/ST=/O=/localityName=/commonName=*.%s/organizationalUnitName=/emailAddress=/
to/commonName=*.%s/
solved the problemTry going into the project directory and running
valet secure
without the domain and see if that works.I tried @mitoop solution to remove nginx and re-install with the --with-http2 flag. That didn’t work as it gave me an unknown flag warning during the install (in the console logs) and continued to install nginx which failed to fix the bug.
I then checked the available flags using
brew options nginx
to see there was no —with-http2 flag. So I did abrew uninstall nginx
and then did abrew install nginx-full --with-http2
(this had the necessary flag and you can check usingbrew options nginx-full
). Once installed, I did avalet install
, cd’ed into the project folder and did avalet secure
andvalet open
. The bug was fixed and my project opened properly with https.Sounds like a certificate file didn’t get generated or somehow got deleted.
Try running the following which will force Valet to regenerate all certs:
@blyleven well i’m using
2.0.4