fbpx
Windows certificate icon

Trust Laravel Homestead SSL Certificates

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:

  1. Click through the privacy warning every time you visit a local site
  2. Add each generated certificate one by one (not sure this will persist through reprovisioning)
  3. 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.

  1. First, ssh into your running Vagrant machine
  2. Navigate to /etc/ssl/certs
    1. In Homestead versions < 11, you want to go to /etc/nginx/ssl
  3. 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 be home/vagrant/dev, so cp ca.homestead.homestead.pem /home/vagrant/dev)
    1. In Homestead versions < 11, this file is ca.homestead.homestead.crt
  4. Open Chrome’s settings (via the menus or just visit chrome://settings in the navigation bar
  5. Pop open the “Advanced” settings
  6. Click “Manage certificates / Manage HTTPS/SSL certificates and settings”. This will open a new window
  7. Start the Import process, and browse for that file we just copied over
  8. 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”
  9. 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

  1. Open up Firefox’s Options
  2. Search for “Certificate”
  3. Click “View Certificates”
  4. Open up the “Authorities” tab and import the certificate we copied in the above step 3.
  5. 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.


Comments

One response to “Trust Laravel Homestead SSL Certificates”

  1. Thanks for this, but I think it should be adjusted. before #7 you need to switch to the Authorities tab. https://superuser.com/a/1276793/373867

Leave a Reply

Your email address will not be published. Required fields are marked *