By default, Laravel Homestead generates a security certificate for all sites you register, allowing you to quickly develop via HTTPS on your local machine.
To get your browser to trust Homestead’s self-signed certificates, you have some options:
- Click through the privacy warning every time you visit a local site
- Add each generated certificate one by one (not sure this will persist through reprovisioning)
- Import Homestead’s root CA to your browser’s trusted authorities
The last one is by far the most long-term solution, and it’s dead simple if you know what you’re doing.
Add Homestead’s CA to Trusted Certificates
These instructions are specific to Chrome, but adding a certificate to other browsers should just be quick Google search away.
The gist is to grab the root CA file from the Homestead Vagrant box, copy it somewhere you can get to it, and import it into Chrome.
- First, ssh into your running Vagrant machine
- Navigate to
/etc/ssl/certs
- In Homestead versions < 11, you want to go to
/etc/nginx/ssl
- In Homestead versions < 11, you want to go to
- Copy
ca.homestead.homestead.pem
from this directory into a directory configured to be shared by your host machine and guest VM (mine happens to behome/vagrant/dev
, socp ca.homestead.homestead.pem /home/vagrant/dev
)- In Homestead versions < 11, this file is
ca.homestead.homestead.crt
- In Homestead versions < 11, this file is
- Open Chrome’s settings (via the menus or just visit
chrome://settings
in the navigation bar - Pop open the “Advanced” settings
- Click “Manage certificates / Manage HTTPS/SSL certificates and settings”. This will open a new window
- Start the Import process, and browse for that file we just copied over
- When selecting the certificate store on the next screen or so, use “Place all certificates in the following store”. Browse, and select “Trusted Root Certification Authorities”
- Finish, and restart Chrome (
chrome://restart
in the navigation bar)
And you’re set! Should be able to visit your various local sites using https without issues.
For Firefox
- Open up Firefox’s Options
- Search for “Certificate”
- Click “View Certificates”
- Open up the “Authorities” tab and import the certificate we copied in the above step 3.
- Visit
about:profiles
to find Firefox’s Restart button and restart the browser
For any other browser (or your OS itself), you should be able to find instructions specific to your browser for actually importing the certificate we copied in step 3.
Leave a Reply